Skip to main content

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

Thanks Igor, That fixed it. Just added the resource directory on every build. 

Thanks,
Aneesh

On Fri, Nov 14, 2014 at 6:31 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
Your build participant must add resources directory to MavenProject on
every build, regardless whether remote resources need to be copied or
not. If this does not explain the problem, you'll have to debug m2e
MavenBuilderImpl and see why/when target/shared-resources is not being
passed to maven resources plugin.

--
Regards,
Igor



On 2014-11-14, 5:43, CoderPlus Team wrote:
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 );

as seen at
https://github.com/apache/maven-plugins/blob/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java#L535

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 -
https://github.com/coderplus/m2e-connector-for-maven-remote-resources-plugin/blob/master/core/src/com/coderplus/m2e/remoteresourcescore/CoderPlusBuildParticipant.java#L84

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


_______________________________________________
m2e-dev mailing list
m2e-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/m2e-dev

_______________________________________________
m2e-dev mailing list
m2e-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/m2e-dev


Back to the top