Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342128 - Update Project Configuration resets Import Order
Summary: Update Project Configuration resets Import Order
Status: CLOSED NOT_ECLIPSE
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-07 06:00 EDT by Kabir Khan CLA
Modified: 2021-04-19 13:24 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kabir Khan CLA 2011-04-07 06:00:23 EDT
Build Identifier: 0.13.0.201103151108

I have some projects where in the Project Properties' Order and Export panel Maven Dependencies must come before the JRE System Library. 

However invoking Update Project Configuration resets that, which gets a bit annoying when you have a few of these projects and you are making frequent updates to the poms.

Reproducible: Always

Steps to Reproduce:
1. Open Project Properties' Order and Export panel, and reorganise the imports so the Maven Dependencies appear above the JRE System Library. 
2. Save the preferences
3. Invoke Update Project Configuration
4.Open Project Properties' Order and Export panel, and see that the the Maven Dependencies no longer appears above the JRE System Library.
Comment 1 Max Rydahl Andersen CLA 2011-04-07 08:18:19 EDT
Kabir, what do you do in the pom.xml to make it work properly during compile/deployment ?

Update Project Configuration should just be doing what the pom.xml states - thus would be good to get a concrete example of what kind of pom breaks?
Comment 2 Igor Fedorenko CLA 2011-04-07 11:15:15 EDT
It is next to impossible to guess desired order of project-level classpath entries unless we can derive it from existing pom.xml information or somehow introduce new possible m2e-specific configuration. Sample project would certainly be helpful to understand the problem better.
Comment 3 Kabir Khan CLA 2011-04-07 11:22:22 EDT
I was getting the prompts to update the project configuration all the time but now that I am trying to get these I can't! I've tried
-Adding dependencies to the parent pom
-Adding dependencies to the pom of the project that needs this reordering

I'll keep an eye out for when I next get this and keep you posted. I'm pretty sure it happens when I kill Eclipse, although I'm hesitant to do that since that caused m2eclipse to spend about 10 minutes reinitialising itself again last time that happened.

The project is https://github.com/jbossas/jboss-as.git
Comment 4 Igor Fedorenko CLA 2011-04-07 11:36:52 EDT
you can force configuration update with right-click->maven->updateProjectConfiguration

FYI, m2e uses project execution plan (i.e. maven plugins and their configuration) to determine if project configuration needs to be updated. Changing dependencies does not require configuration update. Changing maven plugins or their configuration often does.
Comment 5 Max Rydahl Andersen CLA 2011-04-12 10:36:17 EDT
(In reply to comment #3)
> I was getting the prompts to update the project configuration all the time but
> now that I am trying to get these I can't! I've tried
> -Adding dependencies to the parent pom
> -Adding dependencies to the pom of the project that needs this reordering
> 
> I'll keep an eye out for when I next get this and keep you posted. I'm pretty
> sure it happens when I kill Eclipse, although I'm hesitant to do that since
> that caused m2eclipse to spend about 10 minutes reinitialising itself again
> last time that happened.
> 
> The project is https://github.com/jbossas/jboss-as.git


btw. the underlying issue is explained/documented at http://jaitechwriteups.blogspot.com/2011/02/resource-and-new-lookup-attribute-how.html

It's even a hack in Maven to support this so not sure how EE6 is planned to be supported with this or if there is a better way to support this introduction of classes in EE6 that is not part of JDK yet.
Comment 6 Snjezana Peco CLA 2011-04-13 06:15:35 EDT
I have created a plugin that fixes the issue for JBoss AS 7 

It can be installed in the following way:

- install Eclipse Helios 3.6.2 and m2eclipse >= 0.13.0.201104121258/ (update site : https://repository.sonatype.org//content/sites/forge-sites/m2e/0.13.0/N/0.13.0.201104121258/)
- install the EE6 classpath patch from https://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/org.jboss.tools.maven.ee6.classpath.updatesite/
- clone and build JBoss AS 7 as described in http://community.jboss.org/wiki/HackingonAS7
- import jboss-as projects to Eclipse

You will see that the jboss-as-demos project (and other projects that use the maven-dependency-plugin) doesn't  contain any compile errors when calling Maven>Update Project Configuration as well as the Java Build Path has valid ordering. Those projects that don't have the maven-dependency-plugin aren't changed.
Comment 7 Kabir Khan CLA 2011-04-13 16:02:12 EDT
(In reply to comment #6)
> I have created a plugin that fixes the issue for JBoss AS 7 

Awesome! I'll give it a spin in the morning
Comment 8 Kabir Khan CLA 2011-04-21 05:51:11 EDT
Hi,

I installed this patch along with 
Eclipse SDK3.6.2.M20110210-1200
Maven Integration for Eclipse (Incubation)0.13.0.201104071605

and suddenly started getting some weird errors in AS 7. 

Description	Resource	Path	Location	Type
The type Class is not generic; it cannot be parameterized with arguments <? extends Runner>	EJBWebServicesTestCase.java	/jboss-as-testsuite-integration/src/test/java/org/jboss/as/testsuite/integration/wsejb	line 0	Java Problem
The type Class is not generic; it cannot be parameterized with arguments <? extends Runner>	GreeterCommonBusiness.java	/jboss-as-testsuite2-integration-spec/src/main/java/org/jboss/as/test/spec/ejb3/slsb	line 1	Java Problem


The classes are here:
https://github.com/jbossas/jboss-as/blob/master/testsuite/integration/src/test/java/org/jboss/as/testsuite/integration/wsejb/EJBWebServicesTestCase.java
https://github.com/jbossas/jboss-as/blob/master/testsuite2/spec/src/main/java/org/jboss/as/test/spec/ejb3/GreeterCommonBusiness.java

and don't use generics.

Uninstalling this patch causes the problem to disappear
Comment 9 Igor Fedorenko CLA 2011-08-01 02:09:07 EDT
I assume the issue was resolved in m2e-wtp/jbosstools. Please reopen if you think m2e can better handle this scenario, but make sure to explain desired baviour and possible way(s) to implement it as I am still not sure if m2e has enough informtation in pom.xml to do "the right thing".
Comment 10 Denis Roy CLA 2021-04-19 13:24:33 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/