Hi,

If you like to produce a package (zip/tar/whatever kind of archive/bundle) which contains some modules/artifacts etc. from your multi module build it is the best thing to create a separate module in your build with packaging pom and only put the maven-assembly-plugin in it and bind it to the life cycle. This project contains all the needed dependencies in your assembly project pom...which should be packaged into your resulting archive (zip/tar/whatever).

The assembly descriptor contains the appropriate dependencySets/moduleSets/sources etc. entries as needed.

This makes it absolutely sure that using a simple:

mvn clean package

or

mvn install

everything is correctly packaged into the resulting bundle you would like to build.

This is simply a good way of following single responsibility principle.


This produces each time a correct and the same result in contradiction to your supplemental goal calling from command line (you just simply miss it?).

Apart from that using fileSets is usually not the correct way cause it relies on the content which is on the file system which might sometimes not what you really like if you don't do:

mvn clean

before.

If you do things like this:

mvn install
...Doing something here...
mvn install assembly:attached

The resulting bundle which has been produced by using assembly:attached could contain artifacts which are not part of the build..

This is also an problem in reproducibility of builds.

From my point of view a single command like this:


mvn clean package

is easier and more in the paradigm of Maven. Use conventions...

Adding a supplemental call to a plugin goal does not make it easier..

I will rely on just the build as it...without using supplemental goals or using some properties needed to be defined on the command line which I often see in other projects where you need to call some goals of plugins before or after things. I will alway try to get it as simple as possible which will result in just: mvn clean package.

What I don't understand is your reference to maven-release-plugin and maven-invoker-plugin ?


Kind regards
Karl Heinz Marbaise


On 11/03/17 15:56, Alix Lourme wrote:
Hello,

Since maven-assembly-plugin v3.3.0, the *attached* goal has been removed (
MASSEMBLY-704 <https://issues.apache.org/jira/browse/MASSEMBLY-704>).

This *attached* goal was an aggregator (v2.6 source
<https://svn.apache.org/repos/asf/maven/plugins/tags/maven-assembly-plugin-2.6/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachedAssemblyMojo.java>)
but not the *single* goal (v3.0.0 source
<https://svn.apache.org/repos/asf/maven/plugins/tags/maven-assembly-plugin-3.0.0/src/main/java/org/apache/maven/plugins/assembly/mojos/SingleAssemblyMojo.java>
).

Even *attached* goal "*leads to non-standard builds*", it was very useful
on a multi modules project to generate a bundle with some modules items
(artifacts, anything produced on *package* phase, ...) when the descriptor
contains only *fileSets* definitions, using only one Maven command (e.g.: "*mvn
install assembly:attached*") ; because assembly executed after
package/install/deploy phase in each modules.

With module binaries
<https://maven.apache.org/plugins/maven-assembly-plugin/faq.html#module-binaries>
configuration, this job could be done ; but forces reviewing all assembly
descriptors (usage of *moduleSet* in addition of *fileSet*), or using two
steps Maven command.
If you consider that using one command is a prerequisite (
*maven-release-plugin* plugin usage or some jobs with *maven-invoker*), the
v2.x -> v3.x *maven-assembly-plugin* migration could be a little tricky.

=> Is there a way to execute single goal as an aggregator, via pom
configuration (inheritable from a super/company parent pom) ? With
that the *migration
*could be just to replace *attached* by *single*.

Many thanks in advance for tips or idea
Best regards




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to