Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Problem with m2e and resource filtering

Hi everyone.

I'm stuck on this problem since yesterday on my project and I now I decided to create a new and clean project for you to easily reproduce the error (which I'm attaching on the mail).

To help you reproduce it, I created a simple multi module project with two modules with the structure below:

- resource-filtering-bug
--- pom.xml
--- module a
------ pom.xml
------ src/main/java/ModuleAClass.java
--- module b
------ pom.xml
------ src/main/resources/filtered-file.txt

In module a 's pom.xml I have this:

    <properties>
        <my.property.value>property value from module A</my.property.value>
    </properties>

    <build>
        <resources>
            <resource>
                <targetPath>${basedir}/temporary-filtered-resources</targetPath>
                <directory>../module-b/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

While in module b 's pom.xml I have this:

    <properties>
        <my.property.value>property value from module B</my.property.value>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

When I run ' mvn package ' from CLI I have the expected behavior (Maven creates temporary-filtered-resources/filtered-file.txt under module a 's directory switching my.property.value for "property value from module A".

But when I use m2e, It creates the folder temporary-filtered-resources under module a 's directory, but inside it instead of having the filtered-file.txt file (with my.property.value properly switched for "property value from module A"), I have the struture target/classes with no files inside it. Then when I look at Eclipse log file I have this entry, which may be the root of the problem (I noticed it´s like m2e is considering module a 's src/main/java/ModuleAClass as a module b 's resource and trying to copy it from module b to module a, but of course this file doesn´t exist in module b and I get the error):


!ENTRY org.maven.ide.eclipse 4 0 2011-03-29 10:56:29.313
!MESSAGE Build errors for module-a
!STACK 0
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (default-resources) on project module-a: C:\dtp\dependencies\resource-filtering-bug\module-b\src\main\resources\target\classes\ModuleAClass.class (O sistema não pode encontrar o caminho especificado)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.maven.ide.eclipse.internal.embedder.MavenImpl.execute(MavenImpl.java:223)
    at org.maven.ide.eclipse.internal.project.GenericBuildParticipant.executePostBuild(GenericBuildParticipant.java:138)
    at org.maven.ide.eclipse.internal.project.GenericBuildParticipant.build(GenericBuildParticipant.java:77)
    at org.maven.ide.eclipse.internal.builder.MavenBuilder.build(MavenBuilder.java:153)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:311)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:343)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:242)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.apache.maven.plugin.MojoExecutionException: C:\dtp\dependencies\resource-filtering-bug\module-b\src\main\resources\target\classes\ModuleAClass.class (O sistema não pode encontrar o caminho especificado)
    at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:269)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 24 more
Caused by: org.apache.maven.shared.filtering.MavenFilteringException: C:\dtp\dependencies\resource-filtering-bug\module-b\src\main\resources\target\classes\ModuleAClass.class (O sistema não pode encontrar o caminho especificado)
    at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:130)
    at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:267)
    at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:265)
    ... 26 more
Caused by: java.io.FileNotFoundException: C:\dtp\dependencies\resource-filtering-bug\module-b\src\main\resources\target\classes\ModuleAClass.class (O sistema não pode encontrar o caminho especificado)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileReader.<init>(FileReader.java:55)
    at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:2201)
    at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:2170)
    at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:115)
    ... 28 more



Below there are a few descriptions of the files I am attaching to help you understand them:

1. On the file resource-filtering-bug.rar there is the clean Maven project (without Eclipse files, just .java files, .txt resources and pom files)

2. On the file resource-filtering-bug-after-mvn-package.rar there is the result of a simple ' mvn package ' that I ran from CLI (and which is the result I would expect from m2e, but it´s failing)

3. On the file resource-filtering-bug-after-eclipse-project-clean.rar there is the failed result of a simple ' Project < Clean ' that I ran from Eclipse (and which is the result I was not expecting, as I expected the result in file 2 described above)

4. On the file eclipse_log_error.txt there is the log I found for m2e execution, which may give you clues to find the problem that is going on.

So, do you guys have any idea of when this would be fixed and, in the meanwhile, do you have any workaround to this problem?

Thanks and regards,

Rafael Vanderlei.
!ENTRY org.maven.ide.eclipse 4 0 2011-03-29 10:56:29.313
!MESSAGE Build errors for module-a
!STACK 0
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (default-resources) on project module-a: C:\dtp\dependencies\resource-filtering-bug\module-b\src\main\resources\target\classes\ModuleAClass.class (O sistema não pode encontrar o caminho especificado)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.maven.ide.eclipse.internal.embedder.MavenImpl.execute(MavenImpl.java:223)
	at org.maven.ide.eclipse.internal.project.GenericBuildParticipant.executePostBuild(GenericBuildParticipant.java:138)
	at org.maven.ide.eclipse.internal.project.GenericBuildParticipant.build(GenericBuildParticipant.java:77)
	at org.maven.ide.eclipse.internal.builder.MavenBuilder.build(MavenBuilder.java:153)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:311)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:343)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:242)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.apache.maven.plugin.MojoExecutionException: C:\dtp\dependencies\resource-filtering-bug\module-b\src\main\resources\target\classes\ModuleAClass.class (O sistema não pode encontrar o caminho especificado)
	at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:269)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 24 more
Caused by: org.apache.maven.shared.filtering.MavenFilteringException: C:\dtp\dependencies\resource-filtering-bug\module-b\src\main\resources\target\classes\ModuleAClass.class (O sistema não pode encontrar o caminho especificado)
	at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:130)
	at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:267)
	at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:265)
	... 26 more
Caused by: java.io.FileNotFoundException: C:\dtp\dependencies\resource-filtering-bug\module-b\src\main\resources\target\classes\ModuleAClass.class (O sistema não pode encontrar o caminho especificado)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at java.io.FileReader.<init>(FileReader.java:55)
	at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:2201)
	at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:2170)
	at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:115)
	... 28 more

Attachment: resource-filtering-bug.rar
Description: application/rar

Attachment: resource-filtering-bug-after-mvn-package.rar
Description: application/rar

Attachment: resource-filtering-bug-after-eclipse-project-clean.rar
Description: application/rar


Back to the top