简体   繁体   中英

Eclipse build order of maven project is inconsistent

I have two local repos of the same project, two different workspaces one for eclipse neon and one for eclipse oxygen. Both are using the embedded version of maven.

I start by:

  1. Unchecking build automatically

  2. Import maven projects into my workspace

  3. Maven update, force update of snapshots/releases is checked, update project configuration from pom.xml is checked, refresh workspace resources from local filesystem is checked, and clean projects is checked.

  4. Check build automatically

This works fine in Neon and doesn't work in Oxygen.

Oxygen gives me "cannot be resolved to a type" errors.

If I go to

Window/Preferences/General/Workspace/Build Order

the orders are different between the two IDE's.

I've also tried mvn eclipse:clean and mvn eclipse:eclipse and the build order is still incorrect.

I've also tried removing the projects, doing an eclipse clean, delete the .classpath .project .factorypath files, delete the .settings folders, then same 4 steps I started with. I still get the same errors.

If I change the Oxygen build order to match Neon, do another maven update, it builds fine.

My question, is there something else I can try to make eclipse re-evaluate the build order? Am I missing something?

Thanks

I suppose this is a bug in Eclipse Oxygen / m2e 1.8.3. I didn't find a workaround for Oxygen but the it seems like no longed exists in eclipse-SDK-4.8RC4a . If this is an option for you to use Photon, try it out.

Adding this to my pom resolved the issue.

<plugin>
    <groupId>org.eclipse.m2e</groupId>
    <artifactId>lifecycle-mapping</artifactId>
    <version>1.0.0</version>
    <configuration>
        <lifecycleMappingMetadata>
            <pluginExecutions>
                <pluginExecution>
                    <pluginExecutionFilter>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>aspectj-maven-plugin</artifactId>
                        <versionRange>[1.7,)</versionRange>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </pluginExecutionFilter>
                    <action>
                        <execute/>
                    </action>
                </pluginExecution>
            </pluginExecutions>
        </lifecycleMappingMetadata>
    </configuration>
</plugin>

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