How to exclude maven dependencies?

You can utilize the dependency management mechanism. If you create entries in the <dependencyManagement> section of your pom for spring-security-web and spring-web with the desired 3.1.0 version set the managed version of the artifact will override those specified in the transitive dependency tree. I’m not sure if that really saves you any code, but it … Read more

Error “The goal you specified requires a project to execute but there is no POM in this directory” after executing maven command

This link helped: https://stackoverflow.com/a/11199865/1307104 I edit my command by adding quotes for every parameter like this: mvn install:install-file “-DgroupId=org.mozilla” “-DartifactId=jss” “-Dversion=4.2.5” “-Dpackaging=jar” “-Dfile=C:\Users\AArmijos\workspace\componentes-1.0.4\deps\jss-4.2.5.jar” It’s worked.

Multiple install:install-file in a single pom.xml

I would imagine something like this would work (this will install it on every build): <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-install-plugin</artifactId> <executions> <execution> <id>inst_1</id> <phase>initialize</phase> <goals> <goal>install-file</goal> </goals> <configuration> <!– config for file 1 –> </configuration> </execution> <execution> <id>inst_2</id> <phase>initialize</phase> <goals> <goal>install-file</goal> </goals> <configuration> <!– config for file 2 –> </configuration> </execution> <!– execution file 3… … Read more

How to override the `project.build.finalName` Maven property from the command line?

See Introduction to the POM finalName is created as: <build> <finalName>${project.artifactId}-${project.version}</finalName> </build> One of the solutions is to add own property: <properties> <finalName>${project.artifactId}-${project.version}</finalName> </properties> <build> <finalName>${finalName}</finalName> </build> And now try: mvn -DfinalName=build clean package

APKLIB does not get installed in Maven Repo

This special type of apklib dependency only works in android-maven-plugin from command line console. adding it as a dependency in your main project’s POM does not automatically import the library project into your Eclipse, so no library project shown in Package Explorer. Simply adding the apklib as a dependency in pom doesn’t help much for … Read more

Can anyone give a good example of using org.apache.maven.cli.MavenCli programmatically?

Yeah, the’s not much in the way of documentation of MavenCli. The API is significatly simpler but i’d still like some examples. Here’s one that works… MavenCli cli = new MavenCli(); int result = cli.doMain(new String[]{“compile”}, “/home/aioffe/workspace/MiscMaven”, System.out, System.out); System.out.println(“result: ” + result); It takes a dir and runs the ‘compile’ phase…

Maven build issue – Connection to repository refused

Most probably you are behind proxy. Try to do a telnet repo.maven.apache.org 80 and probably you will find it failed to connect. In your settings.xml, add corresponding proxy settings to tell Maven to go through the proxy to download the artifacts <settings> ……. <proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>your_proxy_host</host> <port>your_proxy_port</port> <!– <username>proxyuser</username> <password>somepassword</password> <nonProxyHosts>*.yourdomain.com|*.yourOtherDomain.com</nonProxyHosts> –> </proxy> … Read more

Finding the root directory of a multi module Maven reactor project

use ${session.executionRootDirectory} For the record, ${session.executionRootDirectory} works for me in pom files in Maven 3.0.3. That property will be the directory you’re running in, so run the parent project and each module can get the path to that root directory. I put the plugin configuration that uses this property in the parent pom so that … Read more