2012-04-26 37 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