2012-09-28 57 views
0

我正在使用一些罐子,如junit,僅用於測試目的。我使用maven依賴插件將所有的jar複製到使用maven創建的最終zip文件中。有沒有辦法避免junit jar被抄襲?在創建生產最終罐子時忽略罐子

+2

JUnit應當是範圍「測試」,這將自動不被包裝。 – khmarbaise

+0

聽起來你錯了。你如何通過maven-assembly-plugin創建zip文件?你能展示一下嗎? – khmarbaise

回答

0

在配置放includeScope =運行時

<plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-dependency-plugin</artifactId> 
        <version>2.9</version> 
        <executions> 
         <execution> 
          <id>copy-dependencies</id> 
          <phase>package</phase> 
          <goals> 
           <goal>copy-dependencies</goal> 
          </goals> 
          <configuration> 
           <!-- exclude junit, we need runtime dependency only --> 
           <includeScope>runtime</includeScope> 
           <outputDirectory>${project.build.directory}/dependency-jar/</outputDirectory> 
          </configuration> 
         </execution> 
        </executions> 
       </plugin>