简体   繁体   中英

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

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

I believe ${workspace_loc} is some CDT-specific Eclipse variable, isn't it?

What you need here is ${project.build.directory} , which is the target directory you need. You could also try a few other options, just type ${ and press Ctrl+Space , and it will show you all the usable properties and their actual resolved value as a hint.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM