Using the Nexus rest API to get latest artifact version for given groupid/artifactId

The following URL will retrieve the latest version of log4j 1.2.x: http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=log4j&a=log4j&v=LATEST Documented here Update Example using curl: curl -L “http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=log4j&a=log4j&v=LATEST” -o log4j.jar Update for Log4j2 Log4j 1.2 is EOL since summer 2015 and is known to be broken in Java 9. Here is the link for the Log4j artifacts: log4j-api: https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.apache.logging.log4j&a=log4j-api&v=LATEST log4j-core: https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.apache.logging.log4j&a=log4j-core&v=LATEST

How can I tell jaxb / Maven to generate multiple schema packages?

I had to specify different generateDirectory (without this, the plugin was considering that files were up to date and wasn’t generating anything during the second execution). And I recommend to follow the target/generated-sources/<tool> convention for generated sources so that they will be imported in your favorite IDE automatically. I also recommend to declare several execution … Read more

Force re-download of release dependency using Maven

You cannot make Maven re-download dependencies, but what you can do instead is to purge dependencies that were incorrectly downloaded using mvn dependency:purge-local-repository See: http://maven.apache.org/plugins/maven-dependency-plugin/purge-local-repository-mojo.html This looks up the list of all transitive dependencies of the current project, deletes them, then redownloads them. You can even add it as a plugin into your pom if … Read more

Can I use the path to a Maven dependency as a property?

Here is a correct implementation, using the maven-dependency-plugin properties goal, which can be used anywhere in a pom: <?xml version=”1.0″ encoding=”UTF-8″?> <project> <modelVersion>4.0.0</modelVersion> <groupId>com.stackoverflow</groupId> <artifactId>q2359872</artifactId> <version>2.0-SNAPSHOT</version> <name>q2359872</name> <properties> <!– Must be listed in the dependencies section otherwise it will be null. –> <my.lib>${org.jmockit:jmockit:jar}</my.lib> </properties> <dependencies> <dependency> <groupId>org.jmockit</groupId> <artifactId>jmockit</artifactId> <version>1.11</version> </dependency> </dependencies> <build> <defaultGoal>generate-sources</defaultGoal> <plugins> <plugin> … Read more

Maven2 property that indicates the parent directory

Try setting a property in each pom to find the main project directory. In the parent: <properties> <main.basedir>${project.basedir}</main.basedir> </properties> In the children: <properties> <main.basedir>${project.parent.basedir}</main.basedir> </properties> In the grandchildren: <properties> <main.basedir>${project.parent.parent.basedir}</main.basedir> </properties>