英文:
Maven- Ignore empty/no `main` directory
问题
我有一个在Maven中的黄瓜测试项目,它只是用于测试代码 - 它不会产生任何库或代码。
这很有效,但会在输出中产生一个相当烦人的警告:
[警告] JAR 将为空 - 没有标记要包含的内容!
我通过 mvn verify
运行我的黄瓜测试。
我如何告诉Maven忽略我没有 main
文件夹的事实?我以前做过,但不记得如何操作了,也无法访问那个代码库,Google 上也找不到与损坏的Java项目结构无关的修复方法。
英文:
I have a Cucumber test project in Maven that is only meant to have test code- it does not produce any library or code on its own.
This works great, however, produces a rather annoying warning in the output:
[WARNING] JAR will be empty - no content was marked for inclusion!
I am running my Cucumber tests via mvn verify
How can I tell Maven to ignore the fact that I don't have a main
folder? I've done it before but can't recall how and don't have access to that codebase anymore, and can't find anything on Google where the fix isn't related to malformed java project structure.
答案1
得分: 0
你可以告诉Maven Jar插件,如果JAR文件为空,可以跳过执行。例如:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<skipIfEmpty>true</skipIfEmpty>
</configuration>
</plugin>
英文:
You can tell the Maven Jar Plugin to skip execution if the jar file would be empty. I.e:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<skipIfEmpty>true</skipIfEmpty>
</configuration>
</plugin>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论