jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2.x Eclipse Plugin
  • MECLIPSE-586

Using -Declipse.projectNameTemplate is broken on multi module projects

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.6, 2.7
  • Fix Version/s: None
  • Component/s: Core : .project, Core : Dependencies resolution and build path (.classpath), Core : Multi-projects
  • Labels:
    None
  • Environment:
    Maven version: 2.0.9
    Java version: 1.6.0_10-rc
    OS name: "linux" version: "2.6.27-14-generic" arch: "amd64" Family: "unix"

Description

In version 2.5.1 when specifying projectNameTemplate on the commandline, the .project file and references are generated correcly. In 2.6 and 2.7 the project has the correct name, but referenced projects is not using the specified pattern. This renderes the .project-file and .classpath useless.

Example (using mvn eclipse:eclipse Declipse.projectNameTemplate=trunk[artifactId]) where moduleA depends on moduleB:

moduleA/.project
<projectDescription>
<name>trunk-moduleA</name>
<projects>
<project>moduleB</project>
</projects>
[..]
</projectDescription>

moduleA/.classpath
<classpath>
[..]
<classpathentry kind="src" path="/moduleB"/>
</classpath>

moduleB/.project
<projectDescription>
<name>trunk-moduleB</name>
[..]
</projectDescription>

Issue Links

is duplicated by

Bug - A problem which impairs or prevents the functions of the product. MECLIPSE-609 [regression] projectNameTemplate is not used in moltimodule <projects> in .project

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Baard Johansen added a comment - 09/Jul/09 10:24 AM

Oops, the classpathentry in moduleA/.classpath was wrong. Should have been "/moduleB".

Show
Baard Johansen added a comment - 09/Jul/09 10:24 AM Oops, the classpathentry in moduleA/.classpath was wrong. Should have been "/moduleB".
Hide
Permalink
Seb V added a comment - 28/Aug/09 7:01 AM

Workaround: projectNameTemplate must be specified in the root pom.

 
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-eclipse-plugin</artifactId>
					<configuration>
						<!--
							projectNameTemplate must be specified here as it's broken on the command line:
							http://jira.codehaus.org/browse/MECLIPSE-586
						-->
						<projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
Show
Seb V added a comment - 28/Aug/09 7:01 AM Workaround: projectNameTemplate must be specified in the root pom.
 
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-eclipse-plugin</artifactId>
					<configuration>
						<!--
							projectNameTemplate must be specified here as it's broken on the command line:
							http://jira.codehaus.org/browse/MECLIPSE-586
						-->
						<projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
Hide
Permalink
Marcin Gryszko added a comment - 18/Dec/09 5:17 AM

I tried this workaround but it doesn't work for me. Tried to put <projectNameTemplate> element in the parent POM, parent and child and child only and project names in .classpath are still generated without the version number.

Show
Marcin Gryszko added a comment - 18/Dec/09 5:17 AM I tried this workaround but it doesn't work for me. Tried to put <projectNameTemplate> element in the parent POM, parent and child and child only and project names in .classpath are still generated without the version number.
Hide
Permalink
Wren Weburg added a comment - 03/Mar/10 3:34 PM

I'm also having problems with getting the child projects to reference the correct project name when the eclipse project files are generated. The unchanged artifactId is referenced, not the custom artifact id where we like to have groupId and version added. It would be great if this could be fixed so that my team can set up many branches of the same project in the same Eclipse workspace without all the hassle of manually fixing the dependencies.

For now our manual fix is to change two things with the sub (child) project's files:

1) In the .project file, update the listed project name from "core" to the proper project, e.g.:
<projects>
<project>com.mycompany.core-1.0</project>
</projects>

2) In the .classpath file, make similar change, changing core as per below:
<classpathentry kind="src" path="/com.mycompany.core-1.0"/>

It is hard to write a programmatic fix for this because it would basically have to replicate everything the eclipse plugin does by reading the POM, and of course it's better to fix it at the root cause.

Show
Wren Weburg added a comment - 03/Mar/10 3:34 PM I'm also having problems with getting the child projects to reference the correct project name when the eclipse project files are generated. The unchanged artifactId is referenced, not the custom artifact id where we like to have groupId and version added. It would be great if this could be fixed so that my team can set up many branches of the same project in the same Eclipse workspace without all the hassle of manually fixing the dependencies. For now our manual fix is to change two things with the sub (child) project's files: 1) In the .project file, update the listed project name from "core" to the proper project, e.g.: <projects> <project>com.mycompany.core-1.0</project> </projects> 2) In the .classpath file, make similar change, changing core as per below: <classpathentry kind="src" path="/com.mycompany.core-1.0"/> It is hard to write a programmatic fix for this because it would basically have to replicate everything the eclipse plugin does by reading the POM, and of course it's better to fix it at the root cause.
Hide
Permalink
Vadim Strizhevsky added a comment - 07/Jun/11 10:47 AM

Any progress/update on this issue? Is anyone implemented a patch that makes the plugin do the right thing here?

Show
Vadim Strizhevsky added a comment - 07/Jun/11 10:47 AM Any progress/update on this issue? Is anyone implemented a patch that makes the plugin do the right thing here?
Hide
Permalink
Robert Scholte added a comment - 27/Jul/11 4:33 PM

Adjusting description according to first comment.

Show
Robert Scholte added a comment - 27/Jul/11 4:33 PM Adjusting description according to first comment.
Hide
Permalink
Robert Watkins added a comment - 18/Sep/11 10:54 PM

Just wanted to add:

  • This is occurring with 2.8 and current (mid-September 2011) 2.9-SNAPSHOT builds
  • The workaround (changing the configuration of the plugin) does work.
Show
Robert Watkins added a comment - 18/Sep/11 10:54 PM Just wanted to add:
  • This is occurring with 2.8 and current (mid-September 2011) 2.9-SNAPSHOT builds
  • The workaround (changing the configuration of the plugin) does work.
Hide
Permalink
Max Bowsher added a comment - 16/Mar/12 5:34 AM

This regression was introduced in r727620.

To fix, just delete the code which does the wrong thing from EclipsePlugin.java:

MavenProject reactorProject = getReactorProject( artifact );
if ( reactorProject != null )

{ return IdeUtils.getProjectName( getProjectNameTemplateForMavenProject( reactorProject ), artifact ); }
Show
Max Bowsher added a comment - 16/Mar/12 5:34 AM This regression was introduced in r727620. To fix, just delete the code which does the wrong thing from EclipsePlugin.java: MavenProject reactorProject = getReactorProject( artifact ); if ( reactorProject != null ) { return IdeUtils.getProjectName( getProjectNameTemplateForMavenProject( reactorProject ), artifact ); }

People

  • Assignee:
    Unassigned
    Reporter:
    Baard Johansen
Vote (10)
Watch (11)

Dates

  • Created:
    09/Jul/09 10:22 AM
    Updated:
    16/Mar/12 5:34 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.