Search code examples
eclipsemavenm2eclipsem2e

eclipse variable substitution before invoking maven


Is there a way to tell m2e to resolve eclipse variables before invoking maven? I have this configuration

<plugin>
    <!-- Done to create Target Platform needed by eclipse -->
    <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>
            <configuration>

                <outputDirectory>${workspace_loc}/project-OSGi/target/dependency</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

But ${workspace_loc} doesn't get resolved before invoking maven so I end up with a folder called workspace_loc


Solution

  • My conclusion was that it's not possible to resolve eclipse variables before invoking maven. The only workaround I found was using an environment variable in maven {env.XX} and eclipse ${env_var:XX}, that way both maven and eclipse resolve to the same value