简体   繁体   中英

How to add buildpath options for eclipse from maven

Since last summer Eclipse supports a feature where you can suppress the non-important code issues per build path ( described here ).

When you set this option from the GUI I see that this is reflected as follows in the .classpath file of the project.

    <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
    <classpathentry including="**/*.java" kind="src" path="target/generated-sources/proto">
            <attributes>
                    <attribute name="ignore_optional_problems" value="true"/>
            </attributes>
    </classpathentry>

I have an existing Maven based project and I would like to configure it so that when I run mvn eclipse:eclipse the .classpath file that is generated contains above option for the buildpaths with the generated source code.

I've examined all of the options of the eclipse mojo and I've not been able to figure out how to do this.

How do I accomplish this?

At the moment, neither the Maven2 Eclipse plugin (mvn eclipse:eclipse) nor the Eclipse M2E plugin support this feature.

Both projects have open issues/bugs related to this :

  • A bug has been filed for it in the Eclipse Bugzilla that includes a patch.
  • The Maven2 Eclipse plugin also has an open issue on it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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