zDev - M2E - OSS
  1. zDev - M2E - OSS
  2. MNGECLIPSE-823

Resources are missing from target/clases and/or target/test-classes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.5
    • Fix Version/s: 0.14
    • Component/s: None
    • Labels:
      None
    • Global Rank:
      13128

      Description

      In the project properties there is a Maven page where you can specify the list of goals/phases to invoke when the project is cleaned and when a resource changes.
      The problem is the on-clean goals aren't always being invoked.

      1) Make sure Eclipse is set to build projects automatically.
      2) Open up a pom file, make a change and save it.
      3) The project is automatically rebuild due to the change. In the progress view you see a message about it cleaning.
      4) After the clean completes, Maven is not invoked.

      If you have excluded="**" in the resource dirs entry in the .classpath file (as the m2eclipse plugin will do for you) after the clean described above you will see that none of the resource files have been copied.

        Issue Links

          Activity

          Hide
          Brian Fox added a comment -

          The fix for this is a custom lifecycle definition for projects that see this. It needs to be documented.

          Show
          Brian Fox added a comment - The fix for this is a custom lifecycle definition for projects that see this. It needs to be documented.
          Hide
          Neale Upstone added a comment -

          I'm experiencing this problem. It really makes m2e unworkable, and without an explanation of the above comment, I don't have a workaround either.

          Can you expand on what "custom lifecycle definition" is for these projects (which seems to be all of mine).

          Personally, I'd just rather have the exclude ** dropped and let eclipse compile it.

          Show
          Neale Upstone added a comment - I'm experiencing this problem. It really makes m2e unworkable, and without an explanation of the above comment, I don't have a workaround either. Can you expand on what "custom lifecycle definition" is for these projects (which seems to be all of mine). Personally, I'd just rather have the exclude ** dropped and let eclipse compile it.
          Hide
          Fred Bricon added a comment -

          Custom lifecycle management is described here : https://docs.sonatype.org/pages/viewpage.action?pageId=2949459

          For projects used in WTP, you would typically use something like :

          <profiles>
          	<profile>
          	  <id>m2e</id>
          	  <activation>
          		<property>
          		  <name>m2e.version</name>
          		</property>
          	  </activation>
          	  <build>
          		<plugins>
          		  <plugin>
          			<groupId>org.maven.ide.eclipse</groupId>
          			<artifactId>lifecycle-mapping</artifactId>
          			<version>0.10.0</version>
          			<configuration>
          			  <mappingId>customizable</mappingId>
          			  <configurators>
          				<!-- remove javaConfigurator in EAR pom.xml -->
          				<configurator id='org.maven.ide.eclipse.jdt.javaConfigurator' />
          				<configurator id='org.maven.ide.eclipse.configuration.wtp.configurator' />
          			  </configurators>
          			  <mojoExecutions>
          				<mojoExecution>org.apache.maven.plugins:maven-resources-plugin::resources,testResources</mojoExecution>
          			  </mojoExecutions>
          			</configuration>
          		  </plugin>
          		</plugins>
          		<pluginManagement>
          		  <plugins>
          			<plugin>
          			  <groupId>org.apache.maven.plugins</groupId>
          			  <artifactId>maven-resources-plugin</artifactId>
          			  <version>2.4.3</version>
          			</plugin>
          		  </plugins>
          		</pluginManagement>
          	  </build>
          	</profile>	
          </profiles>
          

          When using a custom lifecycle mapping such as this one, if you're using other m2eclipse configurators (such as Seam, JSF ... from JBoss Tools IDE), you'd have to explicitely add them to the <configurators> list in your pom.xml.

          Regards,

          Fred Bricon

          Show
          Fred Bricon added a comment - Custom lifecycle management is described here : https://docs.sonatype.org/pages/viewpage.action?pageId=2949459 For projects used in WTP, you would typically use something like : <profiles> <profile> <id>m2e</id> <activation> <property> <name>m2e.version</name> </property> </activation> <build> <plugins> <plugin> <groupId>org.maven.ide.eclipse</groupId> <artifactId>lifecycle-mapping</artifactId> <version>0.10.0</version> <configuration> <mappingId>customizable</mappingId> <configurators> <!-- remove javaConfigurator in EAR pom.xml --> <configurator id='org.maven.ide.eclipse.jdt.javaConfigurator' /> <configurator id='org.maven.ide.eclipse.configuration.wtp.configurator' /> </configurators> <mojoExecutions> <mojoExecution>org.apache.maven.plugins:maven-resources-plugin::resources,testResources</mojoExecution> </mojoExecutions> </configuration> </plugin> </plugins> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.4.3</version> </plugin> </plugins> </pluginManagement> </build> </profile> </profiles> When using a custom lifecycle mapping such as this one, if you're using other m2eclipse configurators (such as Seam, JSF ... from JBoss Tools IDE), you'd have to explicitely add them to the <configurators> list in your pom.xml. Regards, Fred Bricon
          Hide
          Jon Vaughan added a comment - - edited

          Fred,

          Your post was linked to from https://issues.sonatype.org/browse/MNGECLIPSE-1068 as a possible solution, so I am trying to understand what you are describing.

          My situation is that I have a WAR project with several dependent jar projects, published via WTP, and I find that the jar projects occasionally turn up without copied resources.

          I don't understand the bug, so I don't understand whether the custom lifecycle detailed here is appropriate to my situation, and whether it should be in the war pom, all the jar poms etc.

          Also your comment about "<!-- remove javaConfigurator in EAR pom.xml -->" makes me suspicious that in fact this isn't going to solve my problem at all.

          If you could post any more detail it would be very much appreciated

          Thanks

          Jon

          EDIT:

          Still really struggling with this not working, some aggressive googling turned up some related notes which I am going to try:
          http://maven.40175.n5.nabble.com/Problem-launching-WTP-on-Tomcat-server-td138161.html

          Show
          Jon Vaughan added a comment - - edited Fred, Your post was linked to from https://issues.sonatype.org/browse/MNGECLIPSE-1068 as a possible solution, so I am trying to understand what you are describing. My situation is that I have a WAR project with several dependent jar projects, published via WTP, and I find that the jar projects occasionally turn up without copied resources. I don't understand the bug, so I don't understand whether the custom lifecycle detailed here is appropriate to my situation, and whether it should be in the war pom, all the jar poms etc. Also your comment about "<!-- remove javaConfigurator in EAR pom.xml -->" makes me suspicious that in fact this isn't going to solve my problem at all. If you could post any more detail it would be very much appreciated Thanks Jon EDIT: Still really struggling with this not working, some aggressive googling turned up some related notes which I am going to try: http://maven.40175.n5.nabble.com/Problem-launching-WTP-on-Tomcat-server-td138161.html
          Hide
          Igor Fedorenko added a comment -

          Generic lifecycle mapping has been removed as part of lifecycle mapping rework described in https://docs.sonatype.org/display/M2ECLIPSE/Project+build+lifecycle+mapping. Project are expected to either work in m2e or fail fast and with clear message. Please open new jira issues if there are still cases when resources go missing from target/classes or target/test-classes folders.

          Show
          Igor Fedorenko added a comment - Generic lifecycle mapping has been removed as part of lifecycle mapping rework described in https://docs.sonatype.org/display/M2ECLIPSE/Project+build+lifecycle+mapping . Project are expected to either work in m2e or fail fast and with clear message. Please open new jira issues if there are still cases when resources go missing from target/classes or target/test-classes folders.

            People

            • Assignee:
              Unassigned
              Reporter:
              Deleted User
              Last Updated By:
              Igor Fedorenko
            • Votes:
              23 Vote for this issue
              Watchers:
              24 Start watching this issue

              Dates

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

                Time Tracking

                Estimated:
                Original Estimate - 3h Original Estimate - 3h
                3h
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 4h
                4h