Gradle alternate to mvn install
sdk/build.gradle: apply plugin: “maven” group = “foo” version = “1.0” example/build.gradle: repositories { mavenLocal() } dependencies { compile “foo:sdk:1.0” } $sdk> gradle install $example> gradle build
sdk/build.gradle: apply plugin: “maven” group = “foo” version = “1.0” example/build.gradle: repositories { mavenLocal() } dependencies { compile “foo:sdk:1.0” } $sdk> gradle install $example> gradle build
<build> <plugins> … <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.3</version> </plugin> </plugins> <resources> <resource> <directory>src/main/java</directory> <includes> <include> **/*.properties</include> </includes> </resource> </resources> … </build>
You can add a new source directory with build-helper: <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>3.2.0</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>src/main/generated</source> </sources> </configuration> </execution> </executions> </plugin> </plugins> </build>
You could use the maven dependency plugin which has a nice dependency:get goal since version 2.1. No need for a pom, everything happens on the command line. To make sure to find the dependency:get goal, you need to explicitly tell maven to use the version 2.1, i.e. you need to use the fully qualified name … Read more
The m2eclipse plugin doesn’t use Eclipse defaults, the m2eclipse plugin derives the settings from the POM. So if you want a Maven project to be configured to use Java 1.6 settings when imported under Eclipse, configure the maven-compiler-plugin appropriately, as I already suggested: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> If your project … Read more
For Maven >= 3 <packaging>jar</packaging> <build> <finalName>WhatEverYouLikey</finalName> </build> See bug report/documentation. (Credits to Matthew’s and his comment) For older Maven versions You set the finalName property in the plugin configuration section: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.2</version> <configuration> <finalName>myJar</finalName> </configuration> </plugin> As indicated in the official documentation.
1) Use maven dependency plugin Create a simple project with pom.xml only. Add your dependency and run: mvn dependency:tree (Version for multi-module Maven project: mvn compile dependency:tree ) Unfortunately dependency mojo must use pom.xml or you get following error: Cannot execute mojo: tree. It requires a project with an existing pom.xml, but the build is … Read more
This seems to be added recently: https://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/3.0.1/ <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency>
What has worked for me (may be a newer feature of Maven) is merely doing wildcards in the exclusion element. I have a multi-module project that contains an “app” module that is referenced in two WAR-packaged modules. One of those WAR-packaged modules really only needs the domain classes (and I haven’t separated them out of … Read more
The Maven Help Plugin is somehow already proposing something for this: help:evaluate evaluates Maven expressions given by the user in an interactive mode. Here is how you would invoke it on the command line to get the ${project.version}: mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate \ -Dexpression=project.version As noted in the comments by Seb T, to only print the version … Read more