Hey guys,
I'm trying to configure an osgi project built with maven when on a CI
server and eclipse/m2e when on my development environment. The goal is to
make the project run locally using Equinox so that i can debug it.

I need to copy the dependencies to a destination folder so that i can use
that folder in a custom target platform to run the project. The issue i
have here is that i need to do this ONLY when in eclipse. i.e. only when
m2e is the one in charge. Is there a way to specify actions that only m2e
will execute but that are ignored outside of m2e when running maven in the
CI?

My current solution is just using maven profiles and it looks like this.
This is a snippet of my POM

<pluginManagement>
                        <plugins>
                                <!--This plugin's configuration is used to store
Eclipse m2e settings
                                        only. It has no influence on the Maven 
build
itself. -->
                                <plugin>
                                        <groupId>org.eclipse.m2e</groupId>
                                        
<artifactId>lifecycle-mapping</artifactId>
                                        <version>1.0.0</version>
                                        <configuration>
                                                <lifecycleMappingMetadata>
                                                        <pluginExecutions>
                                                                
<pluginExecution>
                                                                        <
pluginExecutionFilter>
                                                                                
<groupId>
org.apache.maven.plugins</groupId>
                                                                                
<artifactId>
maven-dependency-plugin</artifactId>
                                                                                
<versionRange>
[2.5.1,)</versionRange>
                                                                                
<goals>
                                                                                
        <goal>
copy-dependencies</goal>
                                                                                
</goals>
                                                                        </
pluginExecutionFilter>
                                                                        <action>
                                                                                
<execute>
                                                                                
        <
runOnIncremental>false</runOnIncremental>
                                                                                
        <
runOnConfiguration>true</runOnConfiguration>
                                                                                
</execute>
                                                                        
</action>
                                                                
</pluginExecution>
                                                        </pluginExecutions>
                                                </lifecycleMappingMetadata>
                                        </configuration>
                                </plugin>
                        </plugins>
                </pluginManagement>
        </build>

        <profiles>
                <profile>
                        <id>developer</id>
                        <build>
                                <plugins>
                                        <plugin>
                                                
<groupId>org.apache.maven.plugins</
groupId>
                                                
<artifactId>maven-dependency-plugin</
artifactId>
                                                <version>2.5.1</version>
                                                <executions>
                                                        <execution>
                                                                
<id>copy-dependencies</id>
                                                                
<phase>process-resources</
phase>
                                                                <goals>
                                                                        <goal>
copy-dependencies</goal>
                                                                </goals>
                                                        </execution>
                                                </executions>
                                        </plugin>
                                </plugins>
                        </build>
                </profile>
        </profiles>

As you can see, the idea is just to have a profile that is not enabled in a
CI and I also specified <runOnIncremental>false</runOnIncremental>      and
<runOnConfiguration>true</runOnConfiguration> in the lifecycle-mapping
plugin so that m2e doesn't execute the copy-dependencies on incremental
builds

Does this make sense? is there a better way to specify an action as being
in the "m2e scope" instead of using maven profiles? the only small
inconvenience with my workaround is that if I were to run maven locally in
the CLI (no m2e) it would also copy the dependencies since the profile is
activated at the system level in the maven settings, but outside of
eclipse/m2e, this step is useless. I also like to avoid maven profiles if
possible

I'm using Eclipse 4.2.1, maven 3.0.4 and m2e 1.2
Thanks for your help
DISCLAIMER:

Privileged and/or Confidential information may be contained in this
message. If you are not the addressee of this message, you may not
copy, use or deliver this message to anyone. In such event, you
should destroy the message and kindly notify the sender by reply
e-mail. It is understood that opinions or conclusions that do not
relate to the official business of the company are neither given
nor endorsed by the company.

Thank You.

_______________________________________________
m2e-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/m2e-users

Reply via email to