How to pass java code a parameter from maven for testing

This is the exact thing I was looking for my automation test and I got it working. Command Line argument mvn clean test -Denv.USER=UAT -Dgroups=Sniff My Pom Xml <?xml version=”1.0″ encoding=”UTF-8″?> <project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”> <modelVersion>4.0.0</modelVersion> <groupId>TestNg</groupId> <artifactId>TestNg</artifactId> <version>1.0</version> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.8</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12.4</version> <configuration> … Read more

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

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

Beginner’s Guide to Setup Xuggler

The following files list the other jars which xuggle depends upon: ivy.xml pom.xml You can read these and then manually retrieve them from the appropriate repository, but I would submit it’s simpler to start using a dependency manager. You asked how to download these dependencies, well ivy has a convenient command-line mode of operation. (See … Read more

What is the implicit ID of a maven plugin execution?

By default, Maven will create an execution id applying the following patterns depending on different cases: Execution id set to: default-cli for plugin:goals executed from the command line Execution id set to: default-<goal_name> for plugin:goals executed as part of the binding defined by a specific packaging Execution id set to: default for plugin:goals executions as … Read more

Maven: Including jar not found in public repository

You can install the project yourself. Or you can use the system scope like the following: <dependency> <groupId>org.group.project</groupId> <artifactId>Project</artifactId> <version>1.0.0</version> <scope>system</scope> <systemPath>${basedir}/lib/project-1.0.0.jar</systemPath> </dependency> systemPath requires the absolute path of the project. To make it easier, if the jar file is within the repository/project, you can use ${basedir} property, which is bound to the root of … Read more

Difference between and tag in Maven `pom.xml` [duplicate]

From Maven documentation: pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one. However, this only configures plugins that are actually … 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