Netbeans: project's main artifact is processed through maven-shade-plugin

一个人想着一个人 提交于 2019-11-28 03:08:44

问题


I am building my project with maven-shade-plugin and Netbeans 8.0 is complaining with the following warning:

Project's main artifact is processed through maven-shade-plugin

When the final artifact jar contains classes not originating in current project, NetBeans internal compiler cannot use the sources of the project for compilation. Then changes done in project's source code only appears in depending projects when project is recompiled. Also applies to features like Refactoring which will not be able to find usages in depending projects.

How can I fix this? What can it break?


回答1:


I found a "fix" by following the instructions over in Apache's Maven Docs

I added the following to my pom in the shade plugin section.

    <configuration>
      <shadedArtifactAttached>true</shadedArtifactAttached>
      <shadedClassifierName>launcher</shadedClassifierName> <!-- Can be any name that makes sense -->
    </configuration>

I now have 2 artifacts but it works for my needs.




回答2:


typically it's a problem in projects depending on this one.

While the jar file in local repo contains classes from it's own dependencies, the src/main/java folder doesn't contain them. That confuses the java engine when it attempts to re-compile the changes done locally in the editor.

there is no way to "fix" it. it's been placed there after repeated bugs were filed against the editor showing compile errors where there were none. I think there is an issue filed for letting the user have the warning disappear.



来源:https://stackoverflow.com/questions/24687845/netbeans-projects-main-artifact-is-processed-through-maven-shade-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!