File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes maven library path for eclipse and environment variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "maven library path for eclipse and environment variables" Watch "maven library path for eclipse and environment variables" New topic

maven library path for eclipse and environment variables

Padmanabh Sahasrabudhe
Ranch Hand

Joined: Mar 04, 2008
Posts: 53
Hi All,

I have two questions:

1] When I point the maven project in eclipse to the settings.xml I get a new Maven llibrary in the Java Build Path. I am not sure from where does the eclipse pick up these jars.

2] Maven at present is not recognising the environment variables I use in settings.xml and pom.xml. Right now, I have substituted them with hard coded absolute path. But is there a way to make maven understand the environmnet variables during designtime?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Eclipse does not understand Maven or Maven libraries. The m2eclipse plugin is what adds that capability - providing you have it installed. Getting a specific eclipse project to display the referenced dependencies has always been a sort of hit-or-miss process involving a lot of thumping and swearing. Some Eclipse versions add a project menu option to allow configuring an existing Java project as a Maven project.

If you are passing OS environment variables to Maven builds (something I don't generally recommend), you can set them using the Run/Debug menu, since Maven execution within Eclipse is treated the same way running any other Java application would be.

If you are setting options in the .m2 configuration file, the copy of Maven running in Eclipse should pick up on them. However, Maven doesn't like relative paths, whether with eclipse or without it, so any paths being set should be absolute.

An IDE is no substitute for an Intelligent Developer.
Peter Johnson

Joined: May 14, 2008
Posts: 5852

1) It would help if you told us exactly what new library you mean. It could also depend on the contents of your settings.xml and the pom.xml for your project. Basically, the m2eclipse plugin will update the Java Build Path based on the dependencies found in the pom.xml file.

2) Do you mean from within Eclipse or from the command line? Also, how are you referencing the environment variables within your settings.xml and pom.xml? Trying to help you by guessing what you are doing is kind of difficult. It would help if you posted an example.

JBoss In Action
I agree. Here's the link:
subject: maven library path for eclipse and environment variables
It's not a secret anymore!