简体   繁体   English

M2Eclipse:当Maven更新工作区中的项目时,如何避免M2E更改我的类路径

[英]M2Eclipse: How to avoid M2E to change my classpath while maven updating project in workspace

I'm doing some eclipse plugin development, I have generated my customized classpath such as <classpathentry kind="src" output="target/classes" path="src/main/webapp"/> , but when I right click -> maven -> maven update project, it(the M2E) will override my classpath as 我正在做一些eclipse插件开发,我生成了自定义的类路径,例如<classpathentry kind="src" output="target/classes" path="src/main/webapp"/> ,但是当我右键单击-> maven-> maven更新项目,它(M2E)将覆盖我的类路径为

<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/webapp">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>

Actually, it will cause many problems for my business. 实际上,这会给我的业务造成很多问题。 Is there any way to configure or code inject to avoid the changes? 有什么方法可以配置或代码注入来避免更改? Any help is appreciated. 任何帮助表示赞赏。

The purpose of the pom (project object model) is to have one central place to include all the information about the build / class path. pom(项目对象模型)的目的是要占据一个中心位置,以包含有关构建/类路径的所有信息。 When updating the maven project, the information of the pom.xml file will update/override the .classpath file. 更新Maven项目时,pom.xml文件的信息将更新/覆盖.classpath文件。

=> Do not manually alter the .classpath file but include the information in the pom.xml file. =>不要手动更改.classpath文件,而应将信息包括在pom.xml文件中。

For eclipse plugins you might want to remove the maven nature of the project since Eclipse plugins have their own way to define dependencies, see MANIFEST.MF 对于eclipse插件,由于Eclipse插件有自己的定义依赖关系的方式,您可能希望删除项目的maven性质,请参阅MANIFEST.MF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM