maven-2
IntelliJ IDEA: “Indexed Maven Repositories” list – how to add remote maven repository in this list?
This list is updated automatically from the repositories specified in your pom files (or inherited from parent project’s pom and settings.xml). If you open a project that has some additional repositories specified, you’ll see them in this list and will be able to update the indices.
Using maven profiles to control build execution
You’re thinking about it a bit backwards: have the profile enable the behaviour, not disable it. This is just what profiles are best at, and is exactly your case: you only want the steps to be run in certain circumstances. So you might have something like: <profile> <id>source-jars</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> … And … Read more
Why doesn’t Maven’s mvn clean ever work the first time?
It may be that your IDE or some other process is holding on to the the “target” folder and preventing maven from deleting it.
Integrate Protocol Buffers into Maven2 build
You’ll find some information about the plugin available in the Protocol Buffers repository in the Protocol Buffers Compiler Maven Plug-In thread on the Protocol Buffers discussion group. My understanding is that it’s usable but lacking tests. I’d give it a try. Or you could just use the antrun plugin (snipet pasted from the thread mentioned … Read more
Maven. Transitive dependencies
My project P depends on dependency A [with a compile scope] which depends on dependency B [with a compile scope]. Unless B is an optional dependency of A, B should be a dependency of P with a “compile(*)” scope (see the table of Dependency Scope and read the note) and should thus be available at … Read more
Can I use the path to a Maven dependency as a property?
Here is a correct implementation, using the maven-dependency-plugin properties goal, which can be used anywhere in a pom: <?xml version=”1.0″ encoding=”UTF-8″?> <project> <modelVersion>4.0.0</modelVersion> <groupId>com.stackoverflow</groupId> <artifactId>q2359872</artifactId> <version>2.0-SNAPSHOT</version> <name>q2359872</name> <properties> <!– Must be listed in the dependencies section otherwise it will be null. –> <my.lib>${org.jmockit:jmockit:jar}</my.lib> </properties> <dependencies> <dependency> <groupId>org.jmockit</groupId> <artifactId>jmockit</artifactId> <version>1.11</version> </dependency> </dependencies> <build> <defaultGoal>generate-sources</defaultGoal> <plugins> <plugin> … Read more
Maven classpath order issues
As of version 2.0.9 maven uses pom order for classpath, so you can actually manipulate it now. We mostly supress transitive dependencies to external libraries that we also include directly. From the release notes of maven 2.0.9: MNG-1412 / MNG-3111 introduced deterministic ordering of dependencies on the classpath. In the past, natural set ordering was … Read more
create directory when needed in maven
Instead of the exec plugin, use the antrun plugin to first create the directory and then invoke the thrift compiler. <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <tasks> <mkdir dir=”target/generated-sources/thrift”/> <exec executable=”${thrift.executable}”> <arg value=”–gen”/> <arg value=”java:beans”/> <arg value=”-o”/> <arg value=”target/generated-sources/thrift”/> <arg value=”src/main/resources/MyThriftMessages.thrift”/> </exec> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> You may also want … Read more
How to run Tomcat 7 using Maven 2 Tomcat plugin?
This works for me: http://tomcat.apache.org/maven-plugin-2.1/ With this plugin config: <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <path>/</path> </configuration> </plugin> And running with mvn clean install tomcat7:run (Please note that tomcat7:run, not tomcat:run.) Plugin documentation is here: http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/plugin-info.html For example, the default value of additionalConfigFilesDir is ${basedir}/src/main/tomcatconf, so if you put your configs into this directory it will … Read more