Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Eclipse m2e plugin issue for cyclic dependent projects(Eclipse m2e plugin issue for cyclic dependent projects)
Eclipse m2e plugin issue for cyclic dependent projects [message #1827766] Fri, 22 May 2020 20:04 Go to next message
ceyhan kasap is currently offline ceyhan kasapFriend
Messages: 3
Registered: May 2020
Junior Member
Hi,

I have an issue with m2e plugin for cyclic dependent projects.

First of all, I know that circular dependencies are bad , maven also does not permit it, they should be avoided and etc. but our legacy projects were mavenized without project structure change (circular dependencies were continued).

Previously, adding each project to other projects build path and setting circular dependencies build path problem to warning was the workaround solution. That way, I could make changes in one project and see the effect in the other immediately.

Now that projects are mavenized, I want to achieve the same workspace environment by enabling m2e workspace resolution (by checking "Resolve dependencies from workspace projects" option).

In eclipse neon (Version: Neon.3 Release (4.6.3) Build id: 20170314-1500) with m2e version 1.7.0.20160603-1933 this is possible. Corresponding maven dependency is resolved from workspace project although there is cycle in build path.

However, in eclipse 2019-09 R (Version: 2019-09 R (4.13.0) Build id: 20190917-1200 with m2e version 1.13.0.20190716-1624) and later releases, build results in infinite loop. For two cyclic projects MY PROJECT A and MY PROJECT B with maven artifact ids MYPROJECTAARTIFACTID, MYPROJECTBARTIFACTID respectively, below is the m2e log for infinite build from 2019-09 R version (I could not gather logs from neon version).

To repeat, I know that maven itself does not allow cyclic project setup but in general eclipse does allow it even for projects with maven nature.

How can I achieve the same in latest eclipse releases?

2020-05-22 21:19:26,588 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.builder.MavenBuilder - Building project MY PROJECT B
2020-05-22 21:19:26,683 [Worker-7: Building Workspace] DEBUG o.e.a.i.i.DefaultLocalRepositoryProvider - Using manager EnhancedLocalRepositoryManager with priority 10.0 for D:\MAVEN_REPONEW
2020-05-22 21:19:26,697 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.p.r.ProjectRegistryManager - Refreshing: [L/MY PROJECT B/pom.xml]
2020-05-22 21:19:26,709 [Worker-7: Building Workspace] DEBUG o.e.a.i.i.DefaultLocalRepositoryProvider - Using manager EnhancedLocalRepositoryManager with priority 10.0 for D:\MAVEN_REPONEW
2020-05-22 21:19:26,712 [Worker-7: Building Workspace] DEBUG o.e.m.c.internal.embedder.MavenImpl - Reading 1 Maven project(s): [D:\LOCALGITREPOS\CYCLE_2019\MYPROJECTBARTIFACTID\MY PROJECT B\pom.xml]
2020-05-22 21:19:26,764 [Worker-7: Building Workspace] DEBUG o.e.a.i.i.DefaultUpdatePolicyAnalyzer - Skipped remote request for ...
2020-05-22 21:19:26,868 [Worker-7: Building Workspace] DEBUG o.e.m.c.internal.embedder.MavenImpl - Read 1 Maven project(s) in 156 ms
2020-05-22 21:19:27,036 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.m.MavenMarkerManager - Created marker 'GroupId is duplicate of parent groupId' on resource '/MY PROJECT B/pom.xml'.
2020-05-22 21:19:27,043 [Worker-7: Building Workspace] DEBUG o.e.a.i.i.DefaultLocalRepositoryProvider - Using manager EnhancedLocalRepositoryManager with priority 10.0 for D:\MAVEN_REPONEW
2020-05-22 21:19:27,086 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory - Loading lifecycle mapping for MavenProject: com.my.company:MYPROJECTBARTIFACTID:1.0.1-SNAPSHOT @ D:\LOCALGITREPOS\CYCLE_2019\MYPROJECTBARTIFACTID\MY PROJECT B\pom.xml.
2020-05-22 21:19:27,670 [Worker-7: Building Workspace] DEBUG o.e.a.i.i.c.DefaultDependencyCollector - Dependency collection stats: {ConflictMarker.analyzeTime=637200, ConflictMarker.markTime=709300, ConflictMarker.nodeCount=118, ConflictIdSorter.graphTime=487300, ConflictIdSorter.topsortTime=290200, ConflictIdSorter.conflictIdCount=45, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=3881500, ConflictResolver.conflictItemCount=72, DefaultDependencyCollector.collectTime=398895400, DefaultDependencyCollector.transformTime=7801200}
2020-05-22 21:19:27,785 [Worker-7: Building Workspace] INFO  o.e.m.c.i.l.LifecycleMappingFactory - Using org.eclipse.m2e.jdt.JarLifecycleMapping lifecycle mapping for MavenProject: com.my.company:MYPROJECTBARTIFACTID:1.0.1-SNAPSHOT @ D:\LOCALGITREPOS\CYCLE_2019\MYPROJECTBARTIFACTID\MY PROJECT B\pom.xml.
2020-05-22 21:19:27,785 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory - Loaded lifecycle mapping in 699 ms for MavenProject: com.my.company:MYPROJECTBARTIFACTID:1.0.1-SNAPSHOT @ D:\LOCALGITREPOS\CYCLE_2019\MYPROJECTBARTIFACTID\MY PROJECT B\pom.xml.
2020-05-22 21:19:27,785 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory - MY PROJECT B is configured by :
2020-05-22 21:19:27,785 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory -  - org.eclipse.m2e.jdt.javaConfigurator
2020-05-22 21:19:27,785 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory -  - org.maven.ide.eclipse.configuration.wtp.java.unsupportedDependencyTypeConfigurator
2020-05-22 21:19:27,785 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory -  - org.eclipse.m2e.wtp.jpa.configurator.jdt
2020-05-22 21:19:27,785 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory -  - org.maven.ide.eclipse.configuration.wtp.utility.configurator
2020-05-22 21:19:27,785 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory -  - org.maven.ide.eclipse.configuration.wtp.webfragment.configurator
2020-05-22 21:19:27,785 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory -  - org.sonatype.m2e.mavenarchiver.jararchiverconfigurator
2020-05-22 21:19:27,785 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory -  - org.eclipse.m2e.wtp.jaxrs.configurator
2020-05-22 21:19:27,786 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.p.r.DefaultMavenDependencyResolver - Resolving dependencies for P/MY PROJECT B: com.my.company:MYPROJECTBARTIFACTID:1.0.1-SNAPSHOT
2020-05-22 21:19:27,786 [Worker-7: Building Workspace] DEBUG o.e.m.c.internal.embedder.MavenImpl - Reading Maven project: D:\LOCALGITREPOS\CYCLE_2019\MYPROJECTBARTIFACTID\MY PROJECT B\pom.xml
2020-05-22 21:19:27,790 [Worker-7: Building Workspace] DEBUG o.e.a.i.i.DefaultUpdatePolicyAnalyzer - Skipped remote request for com.my.company:... locally cached metadata up-to-date.
2020-05-22 21:19:28,529 [Worker-7: Building Workspace] DEBUG o.e.a.i.i.c.DefaultDependencyCollector - Dependency collection stats: {ConflictMarker.analyzeTime=925200, ConflictMarker.markTime=269600, ConflictMarker.nodeCount=328, ConflictIdSorter.graphTime=1694200, ConflictIdSorter.topsortTime=470600, ConflictIdSorter.conflictIdCount=88, ConflictIdSorter.conflictIdCycleCount=48, ConflictResolver.totalTime=7407900, ConflictResolver.conflictItemCount=309, DefaultDependencyCollector.collectTime=730670400, DefaultDependencyCollector.transformTime=10784800}
2020-05-22 21:19:28,539 [Worker-7: Building Workspace] INFO  o.e.m.c.i.p.WorkspaceClassifierResolverManager - Resolving P/MY PROJECT A: com.my.company:MYPROJECTAARTIFACTID:1.0.1-SNAPSHOT with classifier  to /MY PROJECT A/target/classes
2020-05-22 21:19:28,598 [Worker-7: Building Workspace] DEBUG o.e.m.c.internal.embedder.MavenImpl - Read Maven project: D:\LOCALGITREPOS\CYCLE_2019\MYPROJECTBARTIFACTID\MY PROJECT B\pom.xml in 812 ms
2020-05-22 21:19:28,598 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.p.r.DefaultMavenDependencyResolver - Resolved dependencies for P/MY PROJECT B: com.my.company:MYPROJECTBARTIFACTID:1.0.1-SNAPSHOT in 812 ms
2020-05-22 21:19:28,600 [Worker-7: Building Workspace] DEBUG o.e.a.i.i.DefaultLocalRepositoryProvider - Using manager EnhancedLocalRepositoryManager with priority 10.0 for D:\MAVEN_REPONEW
2020-05-22 21:19:28,601 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory - Loading lifecycle mapping for MavenProject: com.my.company:MYPROJECTBARTIFACTID:1.0.1-SNAPSHOT @ D:\LOCALGITREPOS\CYCLE_2019\MYPROJECTBARTIFACTID\MY PROJECT B\pom.xml.
2020-05-22 21:19:28,607 [Worker-1: Decoration Calculation] DEBUG o.e.j.i.storage.file.FileSnapshot - file=C:\Program Files\Git\etc\gitconfig, isRacyClean=false, read=2020-05-22 21:18:57.612000000, lastModified=2020-04-28 20:51:11.602527000, delta=2075266009473000 ns, racy<=2500000000 ns
2020-05-22 21:19:28,607 [Worker-1: Decoration Calculation] DEBUG o.e.j.i.storage.file.FileSnapshot - file=C:\Program Files\Git\etc\gitconfig, is unmodified
.......
2020-05-22 21:19:28,677 [Worker-7: Building Workspace] INFO  o.e.m.c.i.l.LifecycleMappingFactory - Using org.eclipse.m2e.jdt.JarLifecycleMapping lifecycle mapping for MavenProject: com.my.company:MYPROJECTBARTIFACTID:1.0.1-SNAPSHOT @ D:\LOCALGITREPOS\CYCLE_2019\MYPROJECTBARTIFACTID\MY PROJECT B\pom.xml.
2020-05-22 21:19:28,678 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFactory - Loaded lifecycle mapping in 77 ms for MavenProject: com.my.company:MYPROJECTBARTIFACTID:1.0.1-SNAPSHOT @ D:\LOCALGITREPOS\CYCLE_2019\MYPROJECTBARTIFACTID\MY PROJECT B\pom.xml.
2020-05-22 21:19:28,678 [Worker-7: Building Workspace] DEBUG o.e.m.c.i.l.LifecycleMappingFact
Re: Eclipse m2e plugin issue for cyclic dependent projects [message #1827774 is a reply to message #1827766] Sat, 23 May 2020 10:10 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
You could try disabling the Maven Builder in affected projects. Maven would still be used to resolve dependencies (so the Maven Nature is still needed), but building would be under the sole control of Eclipse. Whether or not this is viable may depend on additional build steps that may need to be performed during development aside from compilation. If any, development turn around can actually be quicker if you just manually invoke those steps (e.g., code generators) when needed, rather than relying on maven builds during each incremental build.
Re: Eclipse m2e plugin issue for cyclic dependent projects [message #1827789 is a reply to message #1827774] Sat, 23 May 2020 22:13 Go to previous messageGo to next message
ceyhan kasap is currently offline ceyhan kasapFriend
Messages: 3
Registered: May 2020
Junior Member
Hi Stephan,

Many thanks for the response.

I tried disabling maven builder, but it did not help...

https://github.com/simpleusr/eclipseproblem/blob/master/attachments/removemavenbuildererror.png

Please note that I asked the same question n SO:

https://stackoverflow.com/questions/61962956/eclipse-m2e-plugin-issue-for-cyclic-dependent-projects

and created a sample reproducer project. It would be great if you have a chance to try that.

Thanks in advance
Re: Eclipse m2e plugin issue for cyclic dependent projects [message #1827791 is a reply to message #1827789] Sun, 24 May 2020 04:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

In my experience cyclic project dependencies just don't work; nothing to do with Maven.

Whenever I accidentally loop projects I have to fight hard to discover and remove the loop.

I suggest you refactor out some common plugin / interface plugin to break the loop.

Regards

Ed Willink
Re: Eclipse m2e plugin issue for cyclic dependent projects [message #1827863 is a reply to message #1827791] Mon, 25 May 2020 21:24 Go to previous messageGo to next message
ceyhan kasap is currently offline ceyhan kasapFriend
Messages: 3
Registered: May 2020
Junior Member
Hi Ed,

Many thanks for the response.

I agree that the ultimate solution is to remove cycles but this is almost impossible currently ( I provided more detail in the comments section of the so question link ) .

Although it is a bad practice, I was wondering if there is a way or not to keep this working neon behavior in latest release (since we want to use the latest release of eclipse instead of being stuck in neon) .

Regards
Re: Eclipse m2e plugin issue for cyclic dependent projects [message #1827864 is a reply to message #1827863] Mon, 25 May 2020 21:48 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
I applaud your intention to upgrade to a recent version of Eclipse.

As for you legacy project structure I see two options:

(1) Refactor it using Neon until you got rid of the cycles. Nothing good will come of it if you keep it.

(2) If you cannot refactor, live with the fact that this is actually just one project - as long as nothing can be built without all of the rest. To build it, create a new project into which you import or link all sources. You may preferable make each original source folder a separate source folder in the aggregate project. Build only this aggregate project.
It might even be possible to export separate jars from the different source folders - similar to your current structure of jar files if you must.
Re: Eclipse m2e plugin issue for cyclic dependent projects [message #1827881 is a reply to message #1827864] Tue, 26 May 2020 09:00 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

As Stephan writes, without refactoring, you have just one artificially partitioned large project.

To make progress you might find it helps to (working in an experimental branch)...
- refactor all cyclic elements into a single (acyclic) plugin
- successively identify prefix/postfix packages/classes that have only input/output internal dependencies and factor those as separate plugins

ie if you start with (X,Y,Z) forming a cycle
refactor as XYZ
refactor as Pre1+(XYZ-Pre1)
refactor as Pre1+Pre2+(XYZ-Pre1-Pre2)
refactor as Pre1+Pre2+(XYZ-Pre1-Pre2-Post1)+Post1
...

Where loops are obstinate, it may be helpful to define interfaces that can be called from anywhere in Pre1, with implementations/call-backs that occur elsewhere.

Regards

Ed Willink
Previous Topic:Eclipse loop "sending classpath notifications"
Next Topic:JDT content assist frustration
Goto Forum:
  


Current Time: Thu Mar 28 19:11:32 GMT 2024

Powered by FUDForum. Page generated in 0.06457 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top