zDev - M2E - WTP OSS
  1. zDev - M2E - WTP OSS
  2. MECLIPSEWTP-66

Unwanted files and dirs created when importing maven project

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.8
    • Fix Version/s: 0.13.0
    • Component/s: None
    • Labels:
    • Environment:
      Eclipse 3.4 RC2, Mac OS X 10.5.3
    • Global Rank:
      13170

      Description

      When I import a project with default jar packaging a new META-INF directory containing a MANIFEST.MF file gets created under src/main/java which I have to manually delete.

      For a project with WAR packaging I get a new empty lib directory under src/main/webapp/WEB-INF (I also have the WTP integration installed).

      This unwanted behaviour has appeared in recent dev versions of the m2eclipse from the update-dev site and is also present in the released 0.9.4 from the main update site .

        Issue Links

          Activity

          Hide
          igorfie added a comment -

          Marcello, please provide sample project and steps to reproduce the problem as explained here http://docs.codehaus.org/display/M2ECLIPSE/Reporting+Issues .

          Show
          igorfie added a comment - Marcello, please provide sample project and steps to reproduce the problem as explained here http://docs.codehaus.org/display/M2ECLIPSE/Reporting+Issues .
          Hide
          Eugene Kuleshov added a comment -

          I also would like to clarify, that we couldn't confirm described behavior in our own test projects or projects created using Maven archetypes (see for example maven-archetype-quickstart or maven-archetype-webapp in New Maven Project wizard).

          So, it is most likely some plugin configuration in your pom that cause this and we would need to look at your poms (or test project crafted along the same lines) in order to be able to handle such configuration. Thanks.

          Show
          Eugene Kuleshov added a comment - I also would like to clarify, that we couldn't confirm described behavior in our own test projects or projects created using Maven archetypes (see for example maven-archetype-quickstart or maven-archetype-webapp in New Maven Project wizard). So, it is most likely some plugin configuration in your pom that cause this and we would need to look at your poms (or test project crafted along the same lines) in order to be able to handle such configuration. Thanks.
          Hide
          Eugene Kuleshov added a comment -

          Closing as incomplete. Please reopen if you can provide requested details. Thanks.

          Show
          Eugene Kuleshov added a comment - Closing as incomplete. Please reopen if you can provide requested details. Thanks.
          Hide
          Srdan Srepfler added a comment -

          I think this should be reopened (as on http://jira.codehaus.org/browse/MNGECLIPSE-671 )
          The fact is that creating empty manifest.mf files creates problems like libraries not being seen. I'd suggest either not adding manifest.mf files or regenerating them with manifests generated by maven itself if library dependencies get changed (either by project, parent project or linked projects (ex. war inherits libraries from EAR project).
          The same thing should go probably for ejb-jar descriptors and application.xml and manifests in EAR/EJB projects.
          Also, an EAR project is NOT a Java enabled project, you should not generate any src directory or apply the java facet to EAR eclipse projects.
          I think there is one more issue, something about j2ee.container being applied twice, I fix this by deleting manually the line in the .classpath file but can't remember exactly how was it called. I'll report it if I see this issue again.
          Kudos on how m2eclipse is getting better and better!

          Show
          Srdan Srepfler added a comment - I think this should be reopened (as on http://jira.codehaus.org/browse/MNGECLIPSE-671 ) The fact is that creating empty manifest.mf files creates problems like libraries not being seen. I'd suggest either not adding manifest.mf files or regenerating them with manifests generated by maven itself if library dependencies get changed (either by project, parent project or linked projects (ex. war inherits libraries from EAR project). The same thing should go probably for ejb-jar descriptors and application.xml and manifests in EAR/EJB projects. Also, an EAR project is NOT a Java enabled project, you should not generate any src directory or apply the java facet to EAR eclipse projects. I think there is one more issue, something about j2ee.container being applied twice, I fix this by deleting manually the line in the .classpath file but can't remember exactly how was it called. I'll report it if I see this issue again. Kudos on how m2eclipse is getting better and better!
          Hide
          Srdan Srepfler added a comment -

          This would be the classpath entry I'm getting on my classpath:

          Description Resource Path Location Type
          Build path contains duplicate entry: 'org.eclipse.jst.j2ee.internal.module.container' for project 'CSAIEJB' CSAIEJB line 1 Maven Problem
          (anyhow, this really is a different bug)

          Show
          Srdan Srepfler added a comment - This would be the classpath entry I'm getting on my classpath: Description Resource Path Location Type Build path contains duplicate entry: 'org.eclipse.jst.j2ee.internal.module.container' for project 'CSAIEJB' CSAIEJB line 1 Maven Problem (anyhow, this really is a different bug)
          Hide
          jcstaff added a comment -

          The attached file reproduces the problem, plus demonstrates how the import also creates a src/.../application.xml file within the EAR project and a WEB-INF/lib directory within the WAR project.

          This was originally posted as an Eclipse WTP problem (https://bugs.eclipse.org/bugs/show_bug.cgi?id=285510).
          They rejected it and told me to post it within m2eclipse. This bug report looked to match the issue.

          Steps To Reproduce:
          1.unzip the example provided
          2.note the number of file in the source tree; $ find . -type f | grep -v
          .classpath | grep -v .project | grep -v .settings | wc -l
          52
          3.verify the EAR project only has a pom.xml file; $ find ejbsessionBankEAR/ |
          grep -v .classpath | grep -v .project | grep -v .settings
          ejbsessionBankEAR/
          ejbsessionBankEAR/pom.xml
          4. verify the no MANIFEST.MF files exist; $ find . -name MANIFEST.MF | wc -l
          0
          5. import the root and sub-projects into Eclipse as a maven project
          6. Note that 3 MANIFEST.MF files were created in our source tree (Impl, EJB,
          and WAR); $ find . -name MANIFEST.MF | grep src
          ./ejbsessionBankEJB/src/main/resources/META-INF/MANIFEST.MF
          ./ejbsessionBankImpl/src/main/java/META-INF/MANIFEST.MF
          ./ejbsessionBankWAR/src/main/webapp/META-INF/MANIFEST.MF
          7. Note that a new "src" tree was create in the EAR with an application.xml
          file; $ find . -name application.xml | grep src
          ./ejbsessionBankEAR/src/main/application/META-INF/application.xml
          8. Note that the EJB MANIFEST.MF file is in error - it does not contain a
          reference to the Impl project; $ cat
          ejbsessionBankEJB/src/main/resources/META-INF/MANIFEST.MF
          Manifest-Version: 1.0
          Class-Path:
          9. Note that there was a WEB-INF/lib directory created in the WAR src tree; $
          find . -name lib
          ./ejbsessionBankWAR/src/main/webapp/WEB-INF/lib

          More information:
          I am using a fresh download of Eclipse and the m2eclipse plugin as of late July
          2009. Whenever I import existing projects (as Maven projects), I am getting
          unwanted files generated in my src tree; MANIFEST.MF, WEB-INF/lib, and
          application.xml. In some cases, the files have incorrect contents. However,
          100% of the time I never want these files in my src tree. Maven will create
          these in my target tree. By placing them in the src tree, they are being mixed
          up with real CM code.

          Note that you do not need to successfully build the maven project in order to
          demonstrate that the unwanted src files get created; just import it into
          Eclipse.

          Show
          jcstaff added a comment - The attached file reproduces the problem, plus demonstrates how the import also creates a src/.../application.xml file within the EAR project and a WEB-INF/lib directory within the WAR project. This was originally posted as an Eclipse WTP problem ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=285510 ). They rejected it and told me to post it within m2eclipse. This bug report looked to match the issue. Steps To Reproduce: 1.unzip the example provided 2.note the number of file in the source tree; $ find . -type f | grep -v .classpath | grep -v .project | grep -v .settings | wc -l 52 3.verify the EAR project only has a pom.xml file; $ find ejbsessionBankEAR/ | grep -v .classpath | grep -v .project | grep -v .settings ejbsessionBankEAR/ ejbsessionBankEAR/pom.xml 4. verify the no MANIFEST.MF files exist; $ find . -name MANIFEST.MF | wc -l 0 5. import the root and sub-projects into Eclipse as a maven project 6. Note that 3 MANIFEST.MF files were created in our source tree (Impl, EJB, and WAR); $ find . -name MANIFEST.MF | grep src ./ejbsessionBankEJB/src/main/resources/META-INF/MANIFEST.MF ./ejbsessionBankImpl/src/main/java/META-INF/MANIFEST.MF ./ejbsessionBankWAR/src/main/webapp/META-INF/MANIFEST.MF 7. Note that a new "src" tree was create in the EAR with an application.xml file; $ find . -name application.xml | grep src ./ejbsessionBankEAR/src/main/application/META-INF/application.xml 8. Note that the EJB MANIFEST.MF file is in error - it does not contain a reference to the Impl project; $ cat ejbsessionBankEJB/src/main/resources/META-INF/MANIFEST.MF Manifest-Version: 1.0 Class-Path: 9. Note that there was a WEB-INF/lib directory created in the WAR src tree; $ find . -name lib ./ejbsessionBankWAR/src/main/webapp/WEB-INF/lib More information: I am using a fresh download of Eclipse and the m2eclipse plugin as of late July 2009. Whenever I import existing projects (as Maven projects), I am getting unwanted files generated in my src tree; MANIFEST.MF, WEB-INF/lib, and application.xml. In some cases, the files have incorrect contents. However, 100% of the time I never want these files in my src tree. Maven will create these in my target tree. By placing them in the src tree, they are being mixed up with real CM code. Note that you do not need to successfully build the maven project in order to demonstrate that the unwanted src files get created; just import it into Eclipse.
          Hide
          Igor Fedorenko added a comment -

          Reopened by user request. I still do not believe there is anything we can do from m2e end, but I'd be happy to accept a patch if somebody can prove me wrong

          Show
          Igor Fedorenko added a comment - Reopened by user request. I still do not believe there is anything we can do from m2e end, but I'd be happy to accept a patch if somebody can prove me wrong
          Hide
          Eugene Kuleshov added a comment -

          Jim, I'd recommend to follow up on WTP bug. The issues is easily reproducible without any Maven stuff (e.g. create new project, enable EAR nature and see files created).

          Show
          Eugene Kuleshov added a comment - Jim, I'd recommend to follow up on WTP bug. The issues is easily reproducible without any Maven stuff (e.g. create new project, enable EAR nature and see files created).
          Hide
          Mike Youngstrom added a comment -

          My 2 cents. When I used maven-eclipse-plugin I've never had a META-INF/MANIFEST.MF file created anywhere. When I switched to m2e I now have this problem all the time.

          Show
          Mike Youngstrom added a comment - My 2 cents. When I used maven-eclipse-plugin I've never had a META-INF/MANIFEST.MF file created anywhere. When I switched to m2e I now have this problem all the time.
          Hide
          Rafal Krzewski added a comment -

          While looking around m2e Jira I found two duplicates of this bug: MNGECLIPSE-919, MNGECLIPSE-1541.

          If the creation of these unwanted files happened once, during import of the project it would not have been so bad. Unfortunately I'm experiencing generation of these files after every 'Maven > Update Project Configuration' and even after some POM edits. My blind guess is that while updating project configuration m2e is removing the WAR/EJB/... project facet and the re-adding it. This triggers the "helpful" behavior of WTP. If this is correct, and something can be done to update the project facets incrementally it would in fact be something that can be done about this from m2e side.

          Show
          Rafal Krzewski added a comment - While looking around m2e Jira I found two duplicates of this bug: MNGECLIPSE-919 , MNGECLIPSE-1541 . If the creation of these unwanted files happened once, during import of the project it would not have been so bad. Unfortunately I'm experiencing generation of these files after every 'Maven > Update Project Configuration' and even after some POM edits. My blind guess is that while updating project configuration m2e is removing the WAR/EJB/... project facet and the re-adding it. This triggers the "helpful" behavior of WTP. If this is correct, and something can be done to update the project facets incrementally it would in fact be something that can be done about this from m2e side.
          Hide
          Rafal Krzewski added a comment -

          I've looked at the sources of org.maven.ide.eclipse.wtp.*ProjectConfigurator and I found that EAR, WAR and EJB configurators remove their corresponding project facet (if present) and the configure it back again upon each invocation. The explanation given in the comments is that WTP does not support changing of JEE project facet versions. It seems to me that it should be fairly easy to determine the facet version required by POM, compare it with the version of currently present facet and replace only if necessary.

          The only thing that does not fit into the picture for me is that I cannot see Java nor WTPUtil facets being removed & readded to JAR projects, and I've seen META-INF/MANIFEST.MF proliferating in my JAR projects also. My current theory is that those are the result of WTP propagating changes from the "new" WAR etc projects to it's dependent projects.

          Show
          Rafal Krzewski added a comment - I've looked at the sources of org.maven.ide.eclipse.wtp.*ProjectConfigurator and I found that EAR, WAR and EJB configurators remove their corresponding project facet (if present) and the configure it back again upon each invocation. The explanation given in the comments is that WTP does not support changing of JEE project facet versions. It seems to me that it should be fairly easy to determine the facet version required by POM, compare it with the version of currently present facet and replace only if necessary. The only thing that does not fit into the picture for me is that I cannot see Java nor WTPUtil facets being removed & readded to JAR projects, and I've seen META-INF/MANIFEST.MF proliferating in my JAR projects also. My current theory is that those are the result of WTP propagating changes from the "new" WAR etc projects to it's dependent projects.
          Hide
          Spencer Uresk added a comment -

          I spent some time researching this issue, since it is causing us problems as well. A few things:

          1) I'm not seeing the files being re-added every time I do an Update Maven Configuration. It looks as though the facet is only being added when necessary.

          2) The root "problem" is definitely squarely in the realm of WTP - its facets are creating the directories and files.

          The FacetedProject framework has a mechanism for allowing facet operations to be configured, however. For example, when adding a Dynamic Web Project (jst.web facet), you can tell it to not create a web.xml. It seems as though the creation of the lib directory, manifest files, and whatever else it does could be similarly configurable. Then the WTP configurers in m2eclipse could tell it to not create those files when adding the various facets to a project.

          So, it seems like the best course of action for solving this issue is to request that the WTP project make its facets more configurable, and then take advantage of that ability in m2eclipse once they release a new version.

          Thoughts?

          Show
          Spencer Uresk added a comment - I spent some time researching this issue, since it is causing us problems as well. A few things: 1) I'm not seeing the files being re-added every time I do an Update Maven Configuration. It looks as though the facet is only being added when necessary. 2) The root "problem" is definitely squarely in the realm of WTP - its facets are creating the directories and files. The FacetedProject framework has a mechanism for allowing facet operations to be configured, however. For example, when adding a Dynamic Web Project (jst.web facet), you can tell it to not create a web.xml. It seems as though the creation of the lib directory, manifest files, and whatever else it does could be similarly configurable. Then the WTP configurers in m2eclipse could tell it to not create those files when adding the various facets to a project. So, it seems like the best course of action for solving this issue is to request that the WTP project make its facets more configurable, and then take advantage of that ability in m2eclipse once they release a new version. Thoughts?
          Hide
          Jean-Sébastien Scrève added a comment - - edited

          Hello,

          Before WTP can be more configurable, maybe can we find a workaround ?

          I attach a patch that removes the MANIFEST.MF and parent's folder.

          Regards,

          Jean-Sébastien Scrève

          Show
          Jean-Sébastien Scrève added a comment - - edited Hello, Before WTP can be more configurable, maybe can we find a workaround ? I attach a patch that removes the MANIFEST.MF and parent's folder. Regards, Jean-Sébastien Scrève
          Hide
          Jean-Sébastien Scrève added a comment - - edited

          I just attached the patch I talked about

          Show
          Jean-Sébastien Scrève added a comment - - edited I just attached the patch I talked about
          Hide
          Jean-Sébastien Scrève added a comment -

          Patch

          Show
          Jean-Sébastien Scrève added a comment - Patch
          Hide
          Mike Youngstrom added a comment -

          Though it seems strange I no longer have this issue when using m2e+wtp extension's latest nightly along with eclipse wtp 3.2.1.

          Show
          Mike Youngstrom added a comment - Though it seems strange I no longer have this issue when using m2e+wtp extension's latest nightly along with eclipse wtp 3.2.1.
          Hide
          Fred Bricon added a comment -

          This has been fixed in master, along all the work related to the manifest generation (MECLIPSEWTP-45, MECLIPSEWTP-63)

          Show
          Fred Bricon added a comment - This has been fixed in master, along all the work related to the manifest generation ( MECLIPSEWTP-45 , MECLIPSEWTP-63 )

            People

            • Assignee:
              Fred Bricon
              Reporter:
              Marcello Teodori
              Last Updated By:
              Fred Bricon
            • Votes:
              12 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: