Java – add additional path to exec Maven plugin
•
Java
I want to add an extra classpath for exec Maven plugin
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1.1</version> <configuration> <executable>java</executable> <classpathScope>runtime</classpathScope> <arguments> <argument>%classpath:/Users/kornp/resources</argument> <argument>org.drrabbit.maventest.App</argument> </arguments> </configuration> </plugin>
How do I configure it?
Solution
I have some configuration files in a specific directory outside the source folder So I'm for my POM The XML file defines additional resources
My example directory structure is:
+ src + conf - app.properties - log4j.xml - pom.xml
My POM xml:
<build> <resources> <resource> <directory>conf</directory> </resource> <resource> <directory>src/main/resources</directory> </resource> </resources> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <executable>java</executable> <mainClass>com.mycompany.MyMainClass</mainClass> </configuration> </plugin> </plugins> <build>
Now we can execute the program:
mvn clean compile exec:java
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码