2012-04-26 38 views
0

以下內容現在將我的依賴項放入新創建的lib目錄中。關於mvn彙編

<dependencySets> 
    <dependencySet> 
     <outputDirectory>lib</outputDirectory> 
     <scope>runtime</scope> 
    </dependencySet> 
</dependencySets> 

問題:如何更改排除1個文件?

下不起作用:如果你有例如

<exclude>groupId:artifactId</exclude> 

所以:

 <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-jdbc</artifactId> 
     <version>3.0.5.RELEASE</version> 
    </dependency> 

要排除:

<dependencySets> 
    <dependencySet> 
     <outputDirectory>lib</outputDirectory> 
     <scope>runtime</scope> 
     <excludes> 
      <exclude>my_program-0.0.1-SNAPSHOT.jar</exclude> 
     </excludes> 
    </dependencySet> 
</dependencySets> 
+0

http://maven.apache.org/plugins/maven-assembly-plugin/examples/single/including-and-excluding-artifacts.html – 2012-04-26 13:27:58

回答

1

嘗試使用約定

<exclude>org.springframework:spring-jdbc</exclude> 
+0

有沒有一種通用的方式來描述「你在建什麼」。換句話說,我現在正在構建的jar不應該在'lib'中,但始終在'bin'中 – JAM 2012-04-26 13:42:34

+0

您可以使用項目屬性:$ {project.groupId}:$ {project.artifactId} – Farid 2012-04-26 13:45:14

+0

非常好。謝謝 – JAM 2012-04-26 14:02:19