2012-03-31 7 views
3

maven、つまりすべての依存関係などのクラスパスを見つけて、プラグインの設定の一部として使用する必要があります。ここに例があります設定からMavenクラスパスを取得する

...<systemProperties> 
     <systemProperty> 
      <name>some.system.property.here</name> 
      <value>${maven.runtime.classpath}</value> 
     </systemProperty> 
    </systemProperties> 
    </configuration>... 

残念ながらプロパティ$ {maven.runtime.classpath}は空です。これに相当するものはありますか?

答えて

2

一番簡単な方法は、Groovyのようなものを使用してプログラム的にそれを設定することです。

ここには、設定が必要です。

 <plugin> 
      <groupId>org.codehaus.gmaven</groupId> 
      <artifactId>gmaven-plugin</artifactId> 

      <configuration> 
       <source> 
        import org.codehaus.plexus.util.StringUtils; 
        import java.io.File; 

        System.setProperty("your.classpath.property", StringUtils.join(project.getRuntimeClasspathElements().iterator(), File.pathSeparator)); 
       </source> 
      </configuration> 

      <executions> 
       <execution> 
        <phase>generate-sources</phase> 

        <goals> 
         <goal>execute</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
関連する問題