Using Maven to download dependencies to a directory on the command line

Apache ivy can be run as a standalone jar to download Maven dependencies. No POM required. curl -L -O http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar java -jar ivy-2.3.0.jar -dependency org.jclouds.provider rackspace-cloudservers-us 1.5.8 -retrieve “lib/[artifact]-[revision](-[classifier]).[ext]” Produces the following files: ├── ivy-2.3.0.jar └── lib ├── aopalliance-1.0.jar ├── asm-3.1.jar ├── bcprov-jdk16-1.46.jar ├── cglib-2.2.1-v20090111.jar ├── clojure-1.3.0.jar ├── core.incubator-0.1.0.jar ├── gson-2.2.jar ├── guava-13.0.jar ├── guice-3.0.jar … Read more

IncompatibleClassChangeError: class ClassMetadataReadingVisitor has interface ClassVisitor as super class

This error happens when the loaded class i.e. ClassMetadataReadingVisitor does not respect the contract of inherited abstract class or interface i.e. ClassVisitor. Looks like at load time different versions of the above classes are getting loaded in your case. Seems you have new spring-core jar and old spring-asm jar in your application. ClassMetadataReadingVisitor class is … Read more

How do you stop maven from trying to access http://repo.maven.apache.org?

All pom files inherit from the maven super POM http://maven.apache.org/ref/3.0.4/maven-model-builder/super-pom.html which contains this entry: <repositories> <repository> <id>central</id> <name>Central Repository</name> <url>http://repo.maven.apache.org/maven2</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> Try setting this in your pom (with <id>central</id>): <repositories> <repository> <id>central</id> <url>http://repo.dev.bloomberg.com/content/groups/public</url> <releases> <enabled>false</enabled> </releases> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://repo.dev.bloomberg.com/content/groups/public</url> <releases> <enabled>false</enabled> </releases> </pluginRepository> </pluginRepositories>

How to access maven.build.timestamp for resource filtering

I have discovered this article, explaining that due to a bug in maven, the build timestamp does not get propagated to the filtering. The workaround is to wrap the timestamp in another property: <properties> <timestamp>${maven.build.timestamp}</timestamp> <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format> </properties> Filtering then works as expected for buildTimestamp=${timestamp}

How do I force Maven to use my local repository rather than going out to remote repos to retrieve artifacts?

The dependency has a snapshot version. For snapshots, Maven will check the local repository and if the artifact found in the local repository is too old, it will attempt to find an updated one in the remote repositories. That is probably what you are seeing. Note that this behavior is controlled by the updatePolicy directive … Read more

maven 3: Accessing version of “root” corporate POM

I stopped using maven-antrun-plugin and switched to GMaven instead. I can get the info required with a simple POM hierarchy traversal. <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>groovy-maven-plugin</artifactId> <version>2.0</version> <executions> <execution> <id>echo-build-environment</id> <phase>validate</phase> <goals> <goal>execute</goal> </goals> <configuration> <source> <![CDATA[ def rootPom = project; while (rootPom.parent != null) { rootPom = rootPom.parent; } project.properties.setProperty(‘root.pom.version’, rootPom.version); log.info(” Maven Home: ” + … Read more