Configure Maven to use different JDK for different J2SE versions?

we solved this problem by explicitely sepecify the javac in config of compile plugin (with JAVA_HOME_6 and JAVA_HOME_7 defined as environment variables): and for Java 6 module <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> <executable>${env.JAVA_HOME_6}/bin/javac</executable> <fork>true</fork> </configuration> </plugin> and for Java 7 module <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> <executable>${env.JAVA_HOME_7}/bin/javac</executable> <fork>true</fork> </configuration> … Read more

Multi-module Maven project and jetty:run

Create a profile inside the war module (project-war). Within this profile, configure jetty to attach to a lifecycle phase and execute the run goal explicitly. Now when maven runs from the toplevel project with that profile enabled, it will invoke jetty:run and have sister module dependency resolution (as is normal when executing maven commands from … Read more

What are the official mirrors of the Maven Central Repository?

This is taken from @rvxnet’s answer and an example of why link-only answer are not desirable. I’ve taken this from the 2015-05-20 WaybackMachine version of their link: Official, but not browseable: https://repo1.maven.org/maven2 Others: https://maven.antelink.com/content/repositories/central/ Also, there are official instructions for configuring to use mirrors. Essentially, you add to you settings.xml the something like the following: … Read more

Maven – making child projects that can be independent of their parent

You have to take care of the differences between the parent-child relation and the aggregation concept in Maven2. They are not the same principle, even if they are really often used at the same time. PARENT The first concept is that a project declares in his pom.xml a parent: <project> <modelVersion>4.0.0</modelVersion> <parent> <groupId>foo</groupId> <artifactId>bar</artifactId> <version>42</version> … Read more

Is there a way to tell surefire to skip tests in a certain package?

Let me extend Sean’s answer. This is what you set in pom.xml: <properties> <exclude.tests>nothing-to-exclude</exclude.tests> </properties> <profiles> <profile> <id>fast</id> <properties> <exclude.tests>**/*Dao*.java</exclude.tests> </properties> </profile> </profiles> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <excludes> <exclude>${exclude.tests}</exclude> </excludes> </configuration> </plugin> Then in CI you start them like this: mvn -Pfast test That’s it.

Creating a zip archive of the maven “target” directory

If the bin predefined assembly descriptor doesn’t suit your needs, then you have three options: Using the maven-assembly-plugin – The maven-zip-plugin never came out because the assembly plugin can do everything the zip plugin was doing, and more, see MNG-2243. Using the maven-antrun-plugin (and maybe the build-helper-plugin to attach the zip) – There is an … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)