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:
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.
2. Maven's Multi-Module Project. A multi-module project is built from an aggregator POM that manages a group of submodules. In most cases, the aggregator is located in the project's root directory and must have packaging of type pom.
In the Project tool window, right-click the project folder and select New | Module. Alternatively, from the main menu, select File| New | Module to open the New Module wizard. If you used main menu to add a module then the process of adding a module is the same as Creating a new Maven project.
Open the Intellij and go to File-> New -> Project. From the left tab, select Spring-initializr and select Project SDK in right pane and click next.
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.
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]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With