maven-3
Activate Maven profile if another profile is not activated
Profile x will be the the only active profile when you call mvn … -P x. Reason from the maven documentation: Profiles can be explicitly specified using the -P CLI option. This option takes an argument that is a comma-delimited list of profile-ids to use. When this option is specified, no profiles other than those … Read more
Non-resolvable parent POM for Could not find artifact and ‘parent.relativePath’ points at wrong local POM
I faced the same issue. Setting relative path of the parent in module projects solved the issue. Use <relativePath>../Parent Project Name/pom.xml</relativePath>
Why does the Maven assembly plugin append the descriptor ref to the finalName value?
In your configuration element, try adding <appendAssemblyId>false</appendAssemblyId>. I believe this did the trick for me.
Non-resolvable parent POM using Maven 3.0.3 and relativePath notation
Make sure you Double-Check that the version you refer to in the child-pom is the same as that in the parent-pom. For me, I’d bumped version in the parent and had it as 3.1.0.0-RELEASE, but in the child-pom, I was still referring to the previous version via relativePath, and had it defined as 2.0.0.0-SNAPSHOT. It … Read more
jar file gets corrupted while building with maven
Remove <filtering>true</filtering>, it corrupts the jar files.
Exclude Tests from Maven build
Try with: mvn clean install -DskipTests Source Maven Surefire Plugin – Skipping Tests.
Exception in thread “main” java.lang.AssertionError
I had the same issue. Forcing maven-compiler-plugin to use javac helped me discover actual compilation errors. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <forceJavacCompilerUse>true</forceJavacCompilerUse> </configuration> </plugin> More details can be found in this Maven Compiler Plugin bug report Edit: the issue is fixed in maven-compiler-plugin version 3.10.1
How to execute a maven plugin twice with different property
Given the simple Maven Source Plugin configuration (as an example) you have a shared configuration across all of its executions (outside the executions element) and then a custom configuration per each execution, for the same phase, as requested by your question: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.4</version> <configuration> <includePom>true</includePom> </configuration> <executions> <execution> <id>test-id1</id> <phase>verify</phase> <goals> … Read more
Different maven compiler versions for test and main
If you want to set compliance to the relevant Java version, you can configure the compiler plugin for each execution. Assuming Maven is using a JDK at least as current as the highest version you specify. By using properties you can override that configuration on the commandline or in a child if needed: <plugin> <groupId>org.apache.maven.plugins</groupId> … Read more