开发者

Inter-module dependencies on additional assemblies during a Maven release

We have a multi module project with following modules:

  • Database
  • Persistence
  • Business
  • Application

The 'Database' project is a jar project that creates an additional assembly using the 'maven-assembly-plugin'. This additional assembly contains the database schema.

The plugin configuration is as follows:

  <plugin>
    <!-- create a zip file that contains all the db migration scripts. -->
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.2.1</version>
    <executions>
      <execution>
        <id>attach-schema</id>
        <phase>package</phase>
        <goals>
          <goal>single</goal>
        </goals>
        <configuration>
          <descriptors>
            <descriptor>db-schema-descriptor.xml</descriptor>
          </descriptors>
        </configuration>
      </execution>
    </executions>
  </plugin>

The 'Application' project creates a zipped version of the the application directory structure. Therefore it references the schema assembly in order to extract and copy it to the appropriate location in the application directory structure. The reference is expressed as ordinary maven dependency:

<dependency>
  <groupId>my.application</groupId>
  <artifactId>persistence</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <classifier>db-schema</classifier>
</dependency>

At least there is a multi module project that aggregates the 4 sub modules in order to build the application in one step.

Running 'mvn deploy' on the aggregate project works fine. The开发者_StackOverflow社区 database schema assembly is extracted and copied. But when running a 'mvn release:prepare' on the aggregate project building the 'Application' project fails with the error notification that maven is unable to find the schema assembly with version '0.0.1'. The log file states that the 'Persistence' project has been built before the 'Application' project and that the 'database schema' assembly has been built.

Anyone an idea what I am doing wrong?


See http://www.mail-archive.com/users@maven.apache.org/msg117321.html for an answer


Using the command line 'mvn -DpreparationGoals=install release:prepare' solves the problem. With that command line the prepare release:prepare goals runs the install goal first which installs the release assemblies in the local repository. Later these assemblies can be referenced during the release process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜