Maven: Usage

Maven, is actually a java project manager..

Installing maven in windows need to set system environment vars like JAVA_HOME and PATH..

And it is rather copy & paste than installment..

some useful commands:

mvn archetype:generate
# to give groupid, artifactid.. others remain default..
# groupid is the package name of the project, all source files 
# should put package groupid; in the first line.
# otherwise mvn will think the source file not belongs to the package..
# Before compiling, we need to modify pom.xml under project folder.
# cd into created project folder mvn compile mvn package mvn exec:java
-Dexec.mainClass="groupid.mainclassname" # pdftest.pt.App

when modifying pom.xml, dependencies should be properly put in it. All the dependencies can be found here.

POM stands for Project Object Model.

 

---original file above--- ----problems and solvings below----

1. somet maven repositories cannot be reached without a proxy(sslocal).

use the following setting:

mvn ..  -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=1080

2. sometimes the maven repositories might be down, so fetching from these sites might be hopeless. To make things working, we have to change the url to a reachable url(mirror).

We can find the file refering to the url by searching string in ~/.m2/settings.xml or .pom files in repositories folder, and replace the url with the mirror url.

And to use sgs under .m2 folder makes life easy, but make sure all slashes'/' should be replaced with '\\\/'.

posted on 2017-03-19 21:07  三叁  阅读(288)  评论(0编辑  收藏  举报

导航