views:

232

answers:

1

I have a Maven project that derives the path to a native library using properties which can be set in local profiles. For example:

<project>
  ...
  <build>
    ...
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <environmentVariables>
            <LD_LIBRARY_PATH>${foo.libdir}</LD_LIBRARY_PATH>
          </environmentVariables>
          <fork>always</fork>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>foo-default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <foo.libdir>/usr/local/lib</foo.libdir>
      </properties>
    </profile>
  </profiles>
</project>

When I'm working with this project in Eclipse using the M2Eclipse plugin, I'd like to be able to set up run configurations that also reference this path in the same was (e.g., so I can run the Eclipse debugger on the project). Is there a way to access the Maven property from Eclipse, e.g., so that could set LD_LIBRARY_PATH in the run configuration using a variable like ${maven_property:foo.libdir}?

+1  A: 

I do not think so.

Your maven script could refer to environment variable that you could define in the environment tab of your launch configuration

alt text

But the other way around (i.e. your configuration resolving at launch time some maven script property) is not, as far as I know, possible.

VonC