Can I access Maven properties as variables in Eclipse?

I have a Maven project that displays the path to my own library using properties that can be set in local profiles. For instance:

<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 work with this project in Eclipse using the M2Eclipse plugin , I would like to be able to configure launch options that also refers to this path in the same way (for example, so I can run the Eclipse debugger in the project). Is there a way to access the Maven property from Eclipse, for example, to set LD_LIBRARY_PATH in the startup configuration using a variable like ${maven_property:foo.libdir} ?

+4
source share
1 answer

I do not think so.

Your maven script may refer to an environment variable that you can define in the environment tab to run the configuration

http://web.archive.org/web/20160314161203im_/http://www.vasanth.in/content/binary/WindowsLiveWriter/EclipseTipSpecifyEnvironmentVariablesfor_E319/Eclipse% 20Tip% 20Environment% 20Variablesunb_4% 4f39% 206% 2039% 4bf% 206% 206% 206% 206% 4bf% 206% 4f4% 4f% 206 9afd-ede3a20c37dd.png

But vice versa (for example, your configuration, which allows some maven script property to be run at the time), in my opinion, is not possible.

+2
source

All Articles