File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
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
Author

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?

Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: maven library path for eclipse and environment variables