Execute maven assembly plugin only on child POMs - maven

I have a project with a parent POM and three child projects with.I want to execute the goal assembly:assembly only on one child POM. I already read the following post, but I didn't get it to work with the maven assembly plugin.
Execute Maven plugin goal on child modules, but not on parent
If I run
mvn -DskipTests=true assembly:assembly
I get the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:assembly (default-cli) on project inhouse: Error reading assemblies: No assembly descriptors found. -> [Help 1]
It seems that it always parses the plugin configuration and looks for the assembly descriptor, even then, if I do not put the plugin into the parent POM at all. Has anyone a solution for the assembly plugin?

the rigth option is : <skipAssembly>true</skipAssembly> in order to skip the parent project.

you can define in parent pom properties
<assembly.skipAssembly>true</assembly.skipAssembly>
and overwritte this property in your module pom properties
<assembly.skipAssembly>false</assembly.skipAssembly>

You can configure in the aggregation pom.xml the assembly plugin to skip execution.
In <build><plugins> section
<configuration><skip>true</skip></configuration>

Related

closure compiler maven plugin build failed multi-module project

I have this project: https://github.com/gdesouzacrispim/closure-compiler-minify using closure compiler maven plugin (https://github.com/blutorange/closure-compiler-maven-plugin) where exist a module parent and children;
The plugin is declared in parent pom but it dont have directory path configured int tag baseSourceDir but the children have
Is there any configuration that will ignore when the files isnt existent to be minified in parent module?
[ERROR] Failed to execute goal com.github.blutorange:closure-compiler-maven-plugin:2.22.0:minify (default-minify) on project parent: Execution default-minify of goal com.github.blutorange:closure-compiler-maven-plugin:2.22.0:minify failed: basedir /home/myuser/dev/closure-compile/parent/src/main/webapp/resources does not exist -> [Help 1]

Maven Build Compilation Error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:analyze-dep-mgt

I have a multi-module Maven project in one root project I just want to add another maven module in the root project which contains many module, so after calling the parent from the pom.xml child I get the following error:
parent pom:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:analyze-dep-mgt (default) on project calender: Found Dependency errors.
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:analyze-dep
-mgt (default) on project calender: Found Dependency errors.
analyze-dep-mgt is a mojo which detects whenever there are dependency mismatches during the final resolution of the build. (https://maven.apache.org/plugins/maven-dependency-plugin/analyze-dep-mgt-mojo.html)
There is likely to be a problem with your dependencies. Check this documentation for more info on how to structure your poms. (https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html)
I recently had this error when adding a new dependency in which a transitive dependency was causing the same goal fail. Using an older version of the dependency resolved the issue.

Spring Batch Admin ... Problems Building 1.3.0 RELEASE

I pulled the latest Spring Batch Admin-1.3.0-RELEASE and am trying to build and deploy. In eclipse I imported then as Maven Projects. I try to build with maven and it fails unless I remove these lines from the pom.xml files.
<plugin>
<groupId>com.springsource.bundlor</groupId>
<artifactId>com.springsource.bundlor.maven</artifactId>
</plugin>
or else I get an error
[ERROR] Failed to execute goal com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE:bundlor (bundlor-transform) on project spring-batch-admin-resources: Execution bundlor-transform of goal com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE:bundlor failed: Plugin com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.objectweb.asm:com.springsource.org.objectweb.asm.tree:jar:3.1.0, org.objectweb.asm:com.springsource.org.objectweb.asm.commons:jar:3.1.0, org.objectweb.asm:com.springsource.org.objectweb.asm:jar:3.1.0: Could not find artifact org.objectweb.asm:com.springsource.org.objectweb.asm.tree:jar:3.1.0 in internal-repository (http://nexus-server:8082/nexus/content/groups/released) -> [Help 1]
You would have to add spring repositories in your pom.xml to tell maven to look there as well while looking up for dependencies as mentioned here

What is the necessity of declaring <packaging> in Maven POM file?

I made a Maven project and declared packaging as war.
<packaging>war</packaging>
But this returned an error,
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (make-assembly) on project WaterDealer: Execution make-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single failed: For artifact {ArtifactName:ArtifactName:0.0.1-SNAPSHOT:war}: An attached artifact must have a different ID than its corresponding main artifact.
But when I removed packaging declaration, everything worked just as expected.
Is there any specific reason for this happening? Why did declaring packaging type return an error An attached artifasct must have a different ID than its corresponding main artifact. ? How are they related?
I went through POM reference from this link Maven POM reference but did not find the information very useful.
the error is from the assembly plugin which is not directly related to the packaging.
the packaging defines the type of artifact produced by maven (in general: one pom.xml one artifact - there are exceptions to this rule, e.x. sources jars or javadocs).
the default is "jar". so if you do not specify anything maven will create a jar file.
The other available values for packaging should be a bit self explaining?
The error might be simply the name that results. So packaging jar will create a jar file, "war" will create a war file and so on. If your assembly plugin creates a war file that may conflict with the war created through the pom.xml
The packaging defines some of the binding which are done. This means if you decide to use packaging war it means to run maven-war-plugin in the package phase. This can be read in the appropriate documentation.
The question is why you using maven-assembly-plugin in a war module and apart from that why using such an old version. Take a look on this site which shows the uptodate versions of the plugins:
http://maven.apache.org/plugins/

m2eclipse: Multi-module and parent build exception

I am new to m2eclipse, and I created a dummy java project (mytest4) and checked enable dependency management, after that, the plugin created a pom.xml file. I manually added parent information, such as groupId, artifactId and version, etc. to the dummy project. Then I added modules to the parent project, and the parent projectType is pom not jar. However, when I build using clean install, I get an error:
[DEBUG] Extension realms for project com.multimod:myproject:pom:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[ERROR] The build could not read 1 project ->
[Help 1]org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Child module C:\workspace\myproject\mytest4 of C:\workspace\myproject\pom.xml does not exist #
[ERROR] The project com.multimod:myproject:0.0.1-SNAPSHOT(C:\workspace\myproject\pom.xml) has 1 error
[ERROR] Child module C:\workspace\myproject\mytest4 of C:\workspace\myproject\pom.xml does not exist
I don't understand C:\workspance\myproject\pom.xml does not exist.
Could you give some hints?
Thank you.
You probably have to set the relative path to you parent pom file in the mytest4 pom file. The default is ../pom.xml hence your path C:\workspace\myproject\pom.xml.
As to your sub question in the comment. Right click on the project en select Configure > Convert to Maven Project

Resources