maven basic
On debian 8:
apt-get install mvn # this will install maven 3.0
- mvn archetype:generate –DgroupId=com.mycompany.app –DartifactId=my–app –DarchetypeArtifactId=maven–archetype–quickstart –DinteractiveMode=false
it basically mkdir -p src/main/java/ ( put your java file here), create an pom.xml
2. mvn compile #install clean
Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy, pre-clean, clean, post-clean.
Where/How to find correct packages dependency:
It is a little bit surprise to find that there is no command/options ( just like apt-cache search … ) to search those packages in the maven repos, so we have to depend on the following sites to find those
http://search.maven.org
http://mvnrepository.com/
Why no make in java world?
Those mvn command likes similar to c/c++ make system, what is the reason java world do not use make system?
http://stackoverflow.com/questions/2209827/why-is-no-one-using-make-for-java
The difference between:
javac Main.java
javac This.java
javac That.java
javac Other.java
and
javac Main.java This.java That.java Other.java
is night and day.
more: http://kent.spillner.org/blog/work/2009/11/14/java-build-tools.html
References:
http://spring.io/guides/gs/maven/
https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html