1

I have a multi module spring boot application backed by maven. There is a parent pom.xml which defines all the dependencies. There are 2 modules A and B. Module B is dependent on module A. Both the modules are spring applications and I have repackaged them as jars so that the interdependency between the modules would work. My application runs fine, but I have a problem while generating the liquibase diffs. My module A and B have got all the domain/hibernate entities. The Parent does not have any code. It just has the pom.xml.

When I do a mvn liquibase:diff from the parent, I get

Error setting up or running Liquibase: javax.persistence.PersistenceException: Unable to resolve persistence unit root URL: class path resource [] cannot be resolved to URL because it does not exist

When I do a mvn liquibase:diff from the module B, I get (I have the dependency defined in the parent pom)

 Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.5:diff (default-cli) on project leave: Execution default-cli of goal org.liquibase:liquibase-maven-plugin:3.5.5:diff failed: Plugin org.liquibase:liquibase-maven-plugin:3.5.5 or one of its dependencies could not be resolved: Could not find artifact org.springframework.boot:spring-boot-starter-data-jpa:jar:1.0-SNAPSHOT -> [Help 1]

I dont know if restructuring the jars in the parent pom with the following code which got the application working is causing this problem.

 <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>repackage</id>
                            <configuration>
                                <classifier>exec</classifier>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

Parent POM.xml and it has got a bit list of all the dependencies and plugins

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.xxx</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.4.RELEASE</version>
    </parent>

    <modules>
        <module>A</module>
        <module>B</module>
    </modules>

A Pom.xml

         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.xxx</groupId>
        <artifactId>parent</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>


    <artifactId>A</artifactId>
    <packaging>jar</packaging>
    <properties>
        <java.version>1.8</java.version>
    </properties>
</project>

b Pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.xxx</groupId>
        <artifactId>parent</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>B</artifactId>
    <packaging>jar</packaging>
    <properties>
        <java.version>1.8</java.version>
    </properties>

        <dependencies>
        <dependency>
            <groupId>org.xxx</groupId>
            <artifactId>A</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>
prabha pattabiraman
  • 203
  • 1
  • 2
  • 10

0 Answers0