[ACCEPTED]-How to build project from maven pom file-maven

Accepted answer
Score: 35

mvn install should get you going

0

Score: 10

I have a maven pom file for an open source 39 project. This pom file has all the info 38 like what other jars it depends on etc. I 37 installed maven. Created a dir samprj and 36 copied the pom file into that dir ...

It 35 sounds like you only have the project's 34 POM file. This is not sufficient. You 33 need to checkout the complete source tree for the project. Having done that, change 32 directory to the directory containing the 31 POM file and run mvn install.

Also, don't copy the POM 30 to a different directory. Maven expects 29 to find all of the source files relative 28 to the POM file location.

FOLLOW UP

Thanks for advice. I 27 was not able to use the command mvn install 26 as it gave errors.

Probably because you hadn't 25 checked out the source.

I don't know how 24 to check the source tree of the project 23 ...

Use a subversion client (the svn command 22 for example), or one of the Eclipse subversion 21 plugins.

If this was a properly documented 20 project, there would be clear instructions 19 on what version control and build tools 18 you needed, how to checkout the source code 17 and how to build it.

... as I thought POM 16 itself should have this information to automatically 15 checkout if the source is not check out.

It 14 doesn't necessarily, though in this particular 13 case it does.

Anyway I was able use Eclipse 12 to build the project without errors.

(Other 11 readers can read @icyrock.com's answer for links 10 to the m2eclipse plugin and documentation.)

The 9 only problem is the dependent jars were 8 downloaded but hidden deep paths in .m2 7 repository folder on my linux box.

But I 6 would like these dependent jars to be relative 5 to dir where POM file is.

Sorry, but that 4 is not the way Maven works.

The ~/.m2/repository directory 3 is a fundamental part of Maven. It is not 2 a problem. It is a feature. (Don't fight 1 it!)

Score: 6

If you want to open this within Eclipse, you 3 need to install m2eclipse:

and then import 2 the project as a Maven project as described 1 here:

Score: 0

Try out their getting started guide. It 1 has a lot of good examples:

http://maven.apache.org/guides/getting-started/

More Related questions