Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-dev] Generated Resources not picked during first build.

Hi,
I'm struggling to make an m2e-connector work as expected with m2e.

The maven-remote-resources-plugin dynamically adds generated source folders to the maven project using

project.getResources().add( resource );
or
project.getTestResources().add( resource );


I had written a very simple connector which manages the plugin's lifecycle. 

<plugin>
<!-- this plugin copies all shared resources -->
<artifactId>maven-remote-resources-plugin</artifactId>
<executions>
<execution>
<id>attach-shared-resources</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<resourceBundles>
<resourceBundle>${project.groupId}:shared-resources:${project.version}</resourceBundle>
</resourceBundles>
<attached>true</attached>
<attachToMain>true</attachToMain>
<outputDirectory>${project.build.directory}/shared-resources</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

If I import a project with this configuration, the connector invokes the plugin as expected and it unpacks the shared resources to target/shared-resources. This all works good. But the resource directory attached by the maven-plugin(in this case target/shared-resources) is not automatically  copied to the target/classes directory by the maven-resources-plugin  during the process-resources phase(It copies other resources but not the dynamically attached ones). If I do a manual build after importing the project, it processes the generated resources and copies it to target/classes. 

I'm struggling to find why this doesn't work the first time(when the project is imported)

This is  the link to the build participant - 

Is there something wrong with the BuildParticipant. I had also tried attaching the outputDirectory from within the BuildParticipant, but that didn't help.

Similar functionality works correctly when we use the build-helper-maven-plugin's add-resource goal

Thanks,
Aneesh

Back to the top