问题描述
当我运行mvn deploy:deploy时,maven会将4个jar文件部署到我的内部远程存储库。
When I run "mvn deploy:deploy", maven deploys 4 jar files to my internal remote repository.
它们是:
[module-name] -1.jar
[module-name] -1.pom
[module-name] -1-sources.jar
[module-name] -1-tests.jar
[module-name]-1.jar
[module-name]-1.pom
[module-name]-1-sources.jar
[module-name]-1-tests.jar
正在部署更多的文件,如md5和sha1文件。但是为了简单起见,我只是在这里跳过这些文件。
There are actually more files, such as md5 and sha1 files, being deployed. But for simplicity, I just skip these files here.
有没有办法从部署过程中排除[module-name] -1-sources.jar?
Is there any way to exclude [module-name]-1-sources.jar from the deployment process?
我可以想到的一种方法是使用mvn deploy:deploy-file,这样我可以确定要部署哪个jar。但是由于我有几十个模块来部署,如果我可以在pom.xml中配置部署文件排除,那将是很好的。否则,我必须编写一个脚本来部署。
One way I can think of is to use "mvn deploy:deploy-file", which allows me to pinpoint which jar to deploy. But since I have a few dozen modules to deploy, it'll be nice if I can configure the deployment file exclusion in pom.xml. Otherwise, I'll have to write a script to deploy.
谢谢,
Richard
Thanks,
Richard
推荐答案
从版本 2.2 的 maven-source-plugin 您可以使用配置选项跳过源代码,而无需将插件放在父进程pom中的配置文件中:
As of version 2.2 of the maven-source-plugin you can skip source generation with a config option without having to put the plugin in a profile in your parent pom:
<!-- Do not generate a source jar --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.2.1</version> <configuration> <skipSource>true</skipSource> </configuration> </plugin>
这篇关于如何在mvn deploy中排除源jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!