I've been pouring through maven-eclipse-plugin 2.4 code and realized that there is potentially a problem with org.apache.maven.plugin.eclipse.writers.wtp.EclipseWtpComponentWriter class (line 125), IMHO:

writer.addAttribute( ATTR_DEPLOY_NAME, config.getProject().getArtifactId() );

It seems like the code above assumes deploy-name cannot contain version numbers, project name templates etc. It would be great if the code could follow similar structured approach for setting/getting the project name as in org.apache.maven.plugin.eclipse.writers.EclipseProjectWriter (line 169), which generates .project file:

   writer.writeText( config.getEclipseProjectName() );

Here the project name is set during configuration/dependancy resolution phase by org.apache.maven.plugin.eclipse.EclipsePlugin and later used by the EclipseProjectWriter class.

So I'm curious if this issue could be resolved by simply using getEclipseProjectName() method in org.apache.maven.plugin.eclipse.writers.wtp.EclipseWtpComponentWriter class:

   writer.addAttribute( ATTR_DEPLOY_NAME, config.getEclipseProjectName() );

Please advise..

--
Salman Moghal

----- Original Message ----- From: "Salman Moghal" <[EMAIL PROTECTED]>
To: <users@maven.apache.org>
Sent: Tuesday, February 26, 2008 3:38 PM
Subject: maven-eclipse-plugin 2.4 & versioned projects


Hello:

I'm using maven-eclipse-plugin v2.4 to generate WTP 1.5 resource for Eclipse 3.2.x / RAD v6.x environment. The goal of this exercise is to take advantage of Eclipse 3.2 / RAD v6.x integrated development, debugging, and hot code deployment features. The runtime environment is WebSphere Application Server v6.1. Eclipse / RAD also have M2Eclipse plugin installed for dependency management, etc. There is one slight issue that has me scratching my head for a few days. It has to do with generated WTP v1.5 files.

Essentially, maven eclipse plugin goal "eclipse:m2eclipse" generates all WTP 1.5 files correctly. However, once <addVersionToProjectName>true</addVersionToProjectName> is added to plugin config, .settings/org.eclipse.wst.common.component contains an incorrect entry. The goal generates the .project WTP file properly with a project name containing the POM version number, but the corresponding .settings/org.eclipse.wst.common.component contains an incorrect value for <wb-module deploy-name=".....">. The value of deploy-name= does not contain a POM version number along with the project name.

The reason why having a version number in <wb-module deploy-name= entry is important is because if the EAR / WAR module is deployed to WebSphere runtime in "loose configuration" mode, the runtime complains about not being able to locate corresponding modules. Loose configuration allows the class files to reside in Eclipse / RAD workspace and speeds up the EAR deployment process many folds since no real EAR is generated and installed into WebSphere. Eclipse / RAD loose config file is located under WORKSPACE/.metadata/.plugins/com.ibm.etools.wrd.websphere/looseconfigurations/<EAR NAME>/looseconfig.xmi.

Note that if I manually make the change to the generated .settings/org.eclipse.wst.common.component file by adding version number along with the project name, the runtime doesn't complain and everything works well in loose configuration mode.

May be I'm missing something in maven-eclipse-plugin configuration. Here's what I have:

<!-- maven-eclipse-plugin config for generating WTP 1.5 resources for WAR and EARs -->
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-eclipse-plugin</artifactId>

  <configuration>
    <manifest>
          ${basedir}/src/main/resources/META-INF/MANIFEST.MF
    </manifest>

    <addVersionToProjectName>true</addVersionToProjectName>
    <useProjectReferences>false</useProjectReferences>

    <wtpmanifest>true</wtpmanifest>
    <wtpapplicationxml>true</wtpapplicationxml>
    <wtpversion>1.5</wtpversion>

    <additionalBuildcommands>

<buildcommand>com.ibm.etools.common.migration.MigrationBuilder</buildcommand>
        <buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>

<buildcommand>org.eclipse.wst.common.project.facet.core.builder</buildcommand>

<buildcommand>org.eclipse.wst.validation.validationbuilder</buildcommand>
    </additionalBuildcommands>
    <additionalProjectnatures>

<projectnature>org.eclipse.wst.common.project.facet.core.nature</projectnature>
        <projectnature>org.eclipse.jdt.core.javanature</projectnature>

<projectnature>org.eclipse.wst.common.modulecore.ModuleCoreNature</projectnature>

<projectnature>org.eclipse.jem.workbench.JavaEMFNature</projectnature>
    </additionalProjectnatures>
    <classpathContainers>

<classpathContainer>org.eclipse.jst.j2ee.internal.module.container</classpathContainer>
    </classpathContainers>
  </configuration>

</plugin>
<!-- maven-eclipse-plugin -->


Is there any way to manipulate or affect entries in .settings/org.eclipse.wst.common.component via maven-eclipse-plugin configuration? to If you guys have any clues / pointers / recommendations, please do share.

Regards
Salman Moghal








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to