Maven not picking JAVA_HOME correctly

It’s a bug in the Eclipse Maven support. Eclipse doesn’t support all of the global Maven properties as per the Maven specs. According to the specs: ${java.home} specifies the path to the current JRE_HOME environment use with relative paths to get for example At least in Eclipse 4.3.1 that is not the case, here java.home … Read more

Reading properties file from Maven POM file

Maven allows you to define properties in the project’s POM. You can do this using a POM file similar to the following: <project> … <properties> <server.url>http://localhost:8080/manager/html</server.url> </properties> … <build> <plugins> <plugin> … <configuration> <url>${server.url}</url> <server>tomcat</server> </configuration> … </plugin> </plugins> </build> </project> You can avoid specifying the property within the properties tag, and pass the value … Read more

Gradle not including dependencies in published pom.xml

I was able to work around this by having the script add the dependencies to the pom directly using pom.withXml. //The publication doesn’t know about our dependencies, so we have to manually add them to the pom pom.withXml { def dependenciesNode = asNode().appendNode(‘dependencies’) //Iterate over the compile dependencies (we don’t want the test ones), adding … Read more

What is the difference in Maven between dependency and plugin tags in pom.xml?

Both plugins and dependencies are Jar files. But the difference between them is, most of the work in maven is done using plugins; whereas dependency is just a Jar file which will be added to the classpath while executing the tasks. For example, you use a compiler-plugin to compile the java files. You can’t use … Read more

Verification of dependency authenticity in Maven POM based automated build systems

tl;dr: Non-existent verification mechanisms in Maven and missing language constructs in the POM’s DSL are a serious security threat. Until MNG-6026 is addressed, use someting like Gradle Witness. Introduction None of the answers provided so far seem to solve the problem. Signing artifacts is only a first step into the right direction. But the condition … Read more

How to use POMs as a dependency in Maven?

You have to go with <dependencies> <dependency> <groupId>com.my</groupId> <artifactId>commons-deps</artifactId> <type>pom</type> </dependency> </dependencies> This will transitively add all dependencies declared in com.my:commons-deps to your current POM. Using <dependencyManagement> <dependencies> <dependency> <groupId>…</groupId> <artifactId>…</artifactId> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> works as a simple ‘include’ of artifacts versions in your dependency management. Thus, it won’t add any dependency in … Read more

Manually adding aar with dependency pom/iml file

1. Publishing In your aar project, add maven-publish plugin and add necessary plugin configuration. apply plugin: ‘com.android.library’ apply plugin: ‘maven-publish’ … dependencies { testCompile ‘junit:junit:4.12’ compile ‘com.android.support:appcompat-v7:23.1.1’ compile ‘com.novoda:bintray-release:0.2.7’ } … publishing { publications { maven(MavenPublication) { groupId ‘com.example’ //You can either define these here or get them from project conf elsewhere artifactId ‘example’ version … Read more

Maven adding mainClass in pom.xml with the right folder path

First, your main class doesn’t include src/main/java. Look at the package declaration in that Java file. For example, package org.jis;, then add the main class to that. In other words, it’s only org.jis.Main. You need to configure the maven-jar-plugin instead the of the maven-compiler-plugin. The jar-plugin is the one which is responsible for packaging and … Read more

tech