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

How to simply download a JAR using Maven?

Maven does not work like that. Here’s the closest you’ll get to my knowledge: mvn dependency:get -DremoteRepositories=http://repo1.maven.org/maven2/ \ -DgroupId=junit -DartifactId=junit -Dversion=4.8.2 \ -Dtransitive=false Note that all parameters except transitive are required. Also note that Maven will download the jar to your local repository, and there’s no sensible way (that I know of) to copy it … Read more