java - Maven: Where be the code? -
greetings,
can tell me how heck i'm meant use maven repository or whatever term project?
i've downloaded oauth library google. run mvn compile, test, install, deploy
i want know jar goes can put class path. appreciated!
can tell me how heck i'm meant use maven repository or whatever term project? i've downloaded oauth library google (...) want know jar goes can put class path. appreciated!
basically, need maven "put library on class path" declare library dependency of maven project. let's see how , how started here.
first, need create maven project (i.e. directory containing pom.xml
used describe project , following given structure). maven provides tool can create project you, have run following command (where artifactid
name of project):
mvn archetype:generate -dgroupid=com.stackoverflow -dartifactid=q2722892 -dversion=1.0-snapshot -dinteractivemode=false
then cd
in project directory , edit pom.xml
declare oauth repository (maven has central remote repository called central known default oauth not available in central need tell maven find it):
<project> ... <repositories> <repository> <id>oauth.googlecode.com</id> <url>http://oauth.googlecode.com/svn/code/maven</url> </repository> </repositories> </project>
now can declare dependency on aouth
artifact (or whatever artifact want oauth repository):
<project> ... <dependencies> <dependency> <groupid>net.oauth.core</groupid> <artifactid>oauth</artifactid> <version>20090825</version> </dependency> ... </dependencies> </project>
now can use oauth library in code under src/main/java
, oauth library on class path.
to build project, run install
(this bit more compiling, running tests, packaging recommendation):
mvn install
and find jar of project under target
directory.
to honest, particular example not easiest 1 started maven because requires understand several concepts can't covered in single answer , warmly recommend check maven example introduction of maven before go further.
Comments
Post a Comment