Robert Munteanu
Robert Munteanu

Reputation: 68268

Creating an archive of all jars and source jars for a multi-module project

I'm building a Maven project which has half a dozen modules.

I'm fine with importing it myself using either Maven or Ivy, but other teams would like to use those jars as well, but their practice is to commit the jars and source jars to version control.

I'd like to generate a zip/tar assembly of all modules and their sources which they can use however they like.

I've read Maven Assembly Plugin: Including Module Binaries but I'm shy of using it because:

  1. The linked FAQ entry returns a 404;
  2. I need to manually specify all modules.

Is there an alternative?


Update: I've tried using the built-in assembly descriptors

 mvn assembly:assembly -DprojectModulesOnly=true
 mvn assembly:assembly

and both failed with

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to create assembly: Error creating assembly archive bin: You must set at least one file.

right after all the module builds have run.

Upvotes: 6

Views: 15993

Answers (4)

uzseb
uzseb

Reputation: 11

I had this problem, for me, the solution was NOT put / at the beginning of your <fileset><directory>

If you do that will work on Windows, not on Unix/Linux!

<fileSet>
  <directory>src/main/</directory>
  <outputDirectory></outputDirectory>
  <includes>
    <include>VERSION</include>
  </includes>
</fileSet>

works whereas

<fileSet>
  <directory>/src/main/</directory>
  <outputDirectory></outputDirectory>
  <includes>
    <include>VERSION</include>
  </includes>
</fileSet>

causes

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.3:single (execution-pluggin-assembly) on project test3: Failed to create assembly: Error creating assembly archive assembly: You must set at least one file. -> [Help 1]

Upvotes: 1

Rich Seller
Rich Seller

Reputation: 84028

I think you're on the right lines, the moduleSets options of the assembly plugin handles what you're after.

If you're looking for some useful documentation, the Module Selection section of the Maven book covers it quite thoroughly, including how to configure includes and excludes, handle binaries and sources, and exclude external dependencies.

Upvotes: 4

Pascal Thivent
Pascal Thivent

Reputation: 570285

Have a look at the How to use assembly:assembly using predefined descriptor ids. I think the bin and src pre-defined descriptor files are what you need.

Upvotes: 0

Tommy
Tommy

Reputation: 4111

Sounds like you need a build-server of some kind. I was at JavaZone 2009 this week and looked at Hudson CI http://hudson-ci.org/

The server will create the artifacts you or other teams can use/download.

Upvotes: -4

Related Questions