How do I show the Maven POM hierarchy?

There is no simple Maven command that will show you the chain of parent POMs for a pom.xml. The reason for this is that it is not a common question one would typically ask (more on that below). For your script, you’ll just have to parse the pom.xml file, get the parent artifact coordinates, get … Read more

Maven best practice for generating multiple jars with different/filtered classes?

The Maven general rule is “one primary artifact per POM” for the sake of modularity and the reasons one shouldn’t break this convention (in general) are very well explained in the How to Create Two JARs from One Project (…and why you shouldn’t) blog post. There are however justified exceptions (for example an EJB project … Read more

Logging level under maven surefire

I tried setting java.util.logging.config.file in the MAVEN_OPTS environment variable, which does not work but finally got it working by putting that system property in the pom.xml (and of course creating an appropriate logging.properties in src/test/resources): <plugins> <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <systemProperties> <property> <name>java.util.logging.config.file</name> <value>src/test/resources/logging.properties</value> </property> </systemProperties> </configuration> </plugin> </plugins>

maven-assembly plugin – how to create nested assemblies

With your existing configuration, your two separate configurations for the assembly plugin will be merged, and the configurations will also be merged. To achieve your goal you should define a single assembly-plugin configuration with multiple nested executions, then define the configuration for each execution inside it. The assembly plugin will then execute each assembly sequentially, … Read more

java.net maven repo – JMS artifact missing

Realizing that the Sun’s JARs are not on Maven central due to licensing issues, I added the following Maven repo to my POM Yeah, but http://download.java.net/maven/2/javax/ doesn’t have the jms artifact… The good news is that the JBoss Nexus repository does have it: <repository> <id>repository.jboss.org-public</id> <name>JBoss repository</name> <url>https://repository.jboss.org/nexus/content/groups/public</url> </repository>

How to make maven use system proxy settings

Did you take a look at http://maven.apache.org/guides/mini/guide-proxies.html? In your settings.xml: <settings> . . <proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>proxy.somewhere.com</host> <port>8080</port> <username>proxyuser</username> <password>somepassword</password> <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts> </proxy> </proxies> . . </settings> NOTE: This doesn’t affect Java code! These proxy settings are Maven repository proxy settings.