Maven部署不上传测试jar [英] Maven deploy not to upload test jar

查看:231
本文介绍了Maven部署不上传测试jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有很多预制测试文件的项目,所以显然测试jar文件是非常大的。由于没有人使用测试工具(至少在项目中),所以上传它们并不会获得任何好处。



当我们运行maven deploy命令时,我想它只上传项目jar文件而不是测试jar文件。有没有办法实现?

解决方案

实际上,测试jar文件默认情况下不会构建。您很可能使用附加的测试明确构建它们。如果是这样,您可以从项目中删除该配置,您应该很好去。



查找类似以下内容的部分,您可以删除相同的内容。 p>

 < plugin> 
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-jar-plugin< / artifactId>
< version> 2.2< / version>
<执行>
< execution>
< goals>
< goal> test-jar< / goal>
< / goals>
< / execution>
< / executions>
< / plugin>

如果没有上述,测试将继续运行在您的项目中。


We have project with lot of precanned test files, so obviously the test-jar file is very big. Since no one uses test jar(at least in out project), we don't gain any benefit by uploading it.

When we run the maven deploy command, I want it to only upload the project jar file and not the test jar file. Is there a way to achieve that?

解决方案

Actually the test jar files do not get built by default. It is likely that you are building them explicitly using attached tests. If so, you can remove that config from your project and you should be good to go.

Look for a section like the following and you can remove the same.

 <plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-jar-plugin</artifactId>
   <version>2.2</version>
   <executions>
     <execution>
       <goals>
         <goal>test-jar</goal>
       </goals>
     </execution>
   </executions>
 </plugin>

Tests will continue to run on your project without the above.

这篇关于Maven部署不上传测试jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆