我的项目层次结构如下所示
myProject--->POM.xml myProject--->src--->main--->java---> java files under different sub directories myProject--->src--->main--->resources---> non java files under different sub directories myProject--->src--->main--->webApp---> non java files under different sub directories我想构建项目,以便它只构建java文件,并在最终的jar文件中只包含相应的类文件
这是我在pom.xml中的相关代码,但它没有找到任何要编译的java文件。 我不确定我在这里缺少什么?
<build> <pluginManagement> <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <verbose>true</verbose> <includes> <include>**/*.java</include> </includes> </configuration> </plugin> </plugins> </pluginManagement> </build>更新: -我收到信息消息为No sources to compile但子目录中有java文件
i have my project hierarchy like below
myProject--->POM.xml myProject--->src--->main--->java---> java files under different sub directories myProject--->src--->main--->resources---> non java files under different sub directories myProject--->src--->main--->webApp---> non java files under different sub directoriesi want to build the project so that it builds only java files and only include the corresponding class files in final jar file
Here is my relevant code from pom.xml but it does not find any java files to compile. I am not sure what i am missing here?
<build> <pluginManagement> <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <verbose>true</verbose> <includes> <include>**/*.java</include> </includes> </configuration> </plugin> </plugins> </pluginManagement> </build>UPDATE:- I get info message as No sources to compile but there are java file in subdirectories
最满意答案
我假设你想摆脱像.xml , .xhtml , .properties等文件? 尝试添加
<resources/>或者您可以禁用执行,请参见此处:
如何将Maven构建速度提高30%:抑制未使用的插件执行
取消resource:default-resources和war:default-war执行。
实际上你必须这样做,因为war插件不服从<resources> 。
仍然, jar插件将添加META-INF目录。 可以在使用clean插件的package阶段之前删除它。
查看此页面以获得进一步研究。
I assume that you want to get rid of files like .xml, .xhtml, .properties etc? Try to add
<resources/>Or you can disable the executions, see here:
How to speed up Maven builds by 30 %: Supressing unused plugin executions
Suppress the resource:default-resources and war:default-war executions.
Actually you'll have to, because the war plugin doesn't obey <resources>.
Still, the jar plugin will add META-INF dir. That can be deleted before the package phase using the clean plugin.
Check this page for further studies.
更多推荐
发布评论