0

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

4

1 回答 1

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>
于 2014-12-16T14:04:15.883 回答