i'm using maven exec plugin run project. project has start class uses embedded jetty run app. dependency in normal part of pom jetty marked "provided" because don't want in final war.
how tell exec plugin add 2 jars below classpath when running mvn exec:exec
? executabledepedency
elements not add classpath. currently, classpath of dependency jars not marked test
or provided
.
<plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.5.0</version> <executions> <execution> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executabledependency> <groupid>org.mortbay.jetty</groupid> <artifactid>jetty</artifactid> <version>${jetty.version}</version> </executabledependency> <executabledependency> <groupid>org.mortbay.jetty</groupid> <artifactid>jetty-management</artifactid> <version>${jetty.version}</version> </executabledependency> <executable>java</executable> <arguments> <argument>-classpath</argument> <classpath /> <argument>net.mikeski.start</argument> </arguments> </configuration> </plugin>
turns out there 2 options can use maven when using exec:java (which wanted). can specify true/false each:
- use project dependencies in classpath
- use plugin dependencies in classpath
so, added provided
project dependencies plugin dependencies , set both of properties true , works.
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.5.0</version> <dependencies> <dependency> <dependency> <groupid>org.mortbay.jetty</groupid> <artifactid>jetty</artifactid> <version>${jetty.version}</version> </dependency> <dependency> <groupid>org.mortbay.jetty</groupid> <artifactid>jetty-util</artifactid> <version>${jetty.version}</version> </dependency> <dependency> <groupid>org.mortbay.jetty</groupid> <artifactid>jetty-management</artifactid> <version>${jetty.version}</version> </dependency> </dependencies> <executions> <execution> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <includeplugindependencies>true</includeplugindependencies> <includeprojectdependencies>true</includeprojectdependencies> <executable>java</executable> <mainclass>com.whatever.main</mainclass> </configuration> ...
Comments
Post a Comment