10 java maven-2 properties classpath
我想在我的pom中将属性设置为包含所有项目依赖项的类路径.蚂蚁插件做了这样的事情,所以我知道这绝对是可能的.
我基本上想在我的pom中使用$ {maven.compile.classpath},并让它"正常工作".我不介意使用插件或其他任何东西来实现这一点.
非常感谢,
缺口
这是它的工作原理:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>define-classpath</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<property name="maven.classpath" refid="maven.runtime.classpath"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
执行后你可以使用${maven.classpath}
财产.
从版本2.7开始,maven-dependency-plugin现在可以为类路径设置属性.这是一个例子:
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<outputProperty>maven.compile.classpath</outputProperty>
<pathSeparator>;</pathSeparator>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
如果您希望Eclipse支持,请访问我的更新站点:
http://terraframe.github.io/m2e-maven-dependency-plugin/snapshots/
归档时间: |
|
查看次数: |
13568 次 |
最近记录: |