Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 371097 - New project is not moved to the correct working set and a corrupted project is created
Summary: New project is not moved to the correct working set and a corrupted project i...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Fred Bricon CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-09 10:39 EST by Sebastien Pennec CLA
Modified: 2021-04-19 13:23 EDT (History)
3 users (show)

See Also:


Attachments
Patch fixing the issue (5.57 KB, patch)
2012-03-05 08:32 EST, Fred Bricon CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastien Pennec CLA 2012-02-09 10:39:57 EST
Build Identifier: Version: Indigo Service Release 1 Build id: 20110916-0149

If I create a new project based on a public archetype (for instance, org.apache.maven.archetypes:maven-archetype-j2ee-simple), and choose a working set in the creation dialog, then an incorrect behavior occurs.

Either:

- One of the modules has exactly the same name as the artifactID that was set in the creation dialog. Then this module is moved to the correct working set, but all the other modules are left in the "other projects" working set.

- None of the created modules have exactly the same name as the artifactID that was set in the creation dialog, like it's the case with the simple-j2ee example. In that case, all the generated modules are left in the "Other Projects" working set, and an empty unopenable module is created in the correct working set. This new module can not be opened nor deleted.

Reproducible: Always

Steps to Reproduce:
1.Create a new, empty working set.
2.Right-clic on this working set -> New -> Maven Project
3.Make sure "Add project(s) to working set" is checked and that the newly created working set is selected
4. Next step. Select "all catalogs" and filter "j2ee-simple".
5. Select the filtered archetype
6. Enter any name as the artifact ID
7. Hit "Finish"
Comment 1 Sebastien Pennec CLA 2012-02-10 02:29:22 EST
This also happens with the current milestone, version 1.1.0.20120130-2016.
Comment 2 Sebastien Pennec CLA 2012-02-17 05:39:07 EST
I suspect there is no reason this bug could not be observed on any platform.
Comment 3 Sebastien Pennec CLA 2012-02-20 04:04:57 EST
Given this bug can actually create a corrupted project, the importance should be more than "normal".
Comment 4 Igor Fedorenko CLA 2012-02-20 08:42:01 EST
(In reply to comment #3)
> Given this bug can actually create a corrupted project, the importance should
> be more than "normal".

m2e dev team does not have immediate plans to work on this issue unless a quality patch is provided. And, quite honestly, I don't see this to be a critical issue -- just use unique artifact ids and move on.
Comment 5 Sebastien Pennec CLA 2012-02-20 08:48:15 EST
It's not just about using unique artifact IDS... 

If you use the archetype functionality of Maven to build a multi-module project, which is not uncommon, the dialog asks for one actifactID and the maven archetype uses it to create all the modules.

At this time, the plug in either does just a part of the job, by only moving some of the modules, or does a very bad job by moving nothing and creating a corrupted project.

I don't see how using a unique artifact ID would fix the problem.
Comment 6 Igor Fedorenko CLA 2012-02-20 09:13:00 EST
(In reply to comment #5)
> 
> I don't see how using a unique artifact ID would fix the problem.

If artifact id provided in the dialog does not match anything created by the archetype, everything should work as expected. In any case, if you think this is important, please submit a quality patch and we'll have a look.
Comment 7 Sebastien Pennec CLA 2012-02-21 01:34:29 EST
>> If artifact id provided in the dialog does not match anything created by the
archetype, everything should work as expected. 

It does not. See the steps to reproduce the problem.

Anyway I'm surprised you don't consider creating a corrupted project a problem bad enough to fix that. We obviously don't have the same idea of what is "first-class Apache Maven support in the Eclipse IDE".
Comment 8 Igor Fedorenko CLA 2012-02-21 07:14:51 EST
(In reply to comment #7)
> >> If artifact id provided in the dialog does not match anything created by the
> archetype, everything should work as expected. 
> 
> It does not. See the steps to reproduce the problem.
> 
> Anyway I'm surprised you don't consider creating a corrupted project a problem
> bad enough to fix that. We obviously don't have the same idea of what is
> "first-class Apache Maven support in the Eclipse IDE".

Provide a quality patch and I'll review and apply it. m2e development environment setup is documented in http://wiki.eclipse.org/M2E_Development_Environment
Comment 9 Fred Bricon CLA 2012-03-05 08:32:51 EST
Created attachment 212062 [details]
Patch fixing the issue

The fix is fairly trivial but requires to change the public API for IProjectConfigurationManager from :
void createArchetypeProject(...)
to 
List<IProject> createArchetypeProject(...)

I don't think that can be a problem, but since that's public API change, I prefer Igor's greenlight before pushing any changes.
Comment 10 Sebastien Pennec CLA 2012-03-13 11:08:32 EDT
(In reply to comment #9)
> Created attachment 212062 [details]
> Patch fixing the issue
> 
> The fix is fairly trivial but requires to change the public API for
> IProjectConfigurationManager from :
> void createArchetypeProject(...)
> to 
> List<IProject> createArchetypeProject(...)
> 
> I don't think that can be a problem, but since that's public API change, I
> prefer Igor's greenlight before pushing any changes.

Hi Fred,

Thanks for making this patch!

Have you had any contacts with Igor regarding the public API change?
Comment 11 Fred Bricon CLA 2012-03-20 07:14:12 EDT
Committed fix in http://git.eclipse.org/c/m2e/m2e-core.git/commit/?id=7e5cbde3cd2b93ff2f1748871207987404b82901

I still need to add some regression tests.

Igor, we're short of Target Milestones (M6+1 ...)
Comment 12 Fred Bricon CLA 2012-03-20 08:12:28 EDT
Sébastien, 

you can test a dev build from https://repository.sonatype.org/content/sites/forge-sites/m2e/1.1.0/N/LATEST/
Comment 13 Sebastien Pennec CLA 2012-03-20 08:16:20 EDT
(In reply to comment #12)
> Sébastien, 
> 
> you can test a dev build from
> https://repository.sonatype.org/content/sites/forge-sites/m2e/1.1.0/N/LATEST/

Hello Fred,

I'll test this build asap and post a feedback here. Thanks!
Comment 14 Sebastien Pennec CLA 2012-03-21 08:39:44 EDT
(In reply to comment #12)
> Sébastien, 
> 
> you can test a dev build from
> https://repository.sonatype.org/content/sites/forge-sites/m2e/1.1.0/N/LATEST/

Hello Fred,

I've tried with the specified build, on a brand new Eclipse installation and it works great, thanks!
Comment 15 Sebastien Pennec CLA 2012-03-27 07:14:44 EDT
Hello,

Do you have a target milestone for this bug? I guess that it has not made it into the 1.1 M6 or has it?
Comment 16 Fred Bricon CLA 2012-03-27 08:34:19 EDT
The fix will be available in the next Milestone release. I can't add target milestones to the list (or if I can, don't know how). Need Igor's über powers.
Comment 17 Igor Fedorenko CLA 2013-09-29 10:04:45 EDT
apparently fixed long time ago
Comment 18 Denis Roy CLA 2021-04-19 13:23:42 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/