在创建生产的最终罐子时忽略罐子

时间:2012-09-28 12:17:31

标签: maven maven-2

我正在使用像junit这样的罐子,这些罐子仅用于测试目的。我正在使用maven依赖插件将所有jar复制到使用maven创建的最终zip文件。有没有办法避免junit jar被复制?

1 个答案:

答案 0 :(得分:0)

在配置中输入includeScope = runtime

 <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>
相关问题