Maven

mavn force update from remote
mvn clean install -U
 * 1) -U means force update of dependencies

maven with JDK

 * maven 3.2 requires jdk 1.6 or above, maven 3.0/3.1 require jdk 1.5 or above

oschina maven repo

 * http://maven.oschina.net/help.html - config maven repo use oschina maven repo

configure maven

 * http://maven.apache.org/guides/mini/guide-configuring-maven.html
 * http://maven.apache.org/ref/3.2.3/maven-settings/settings.html
 * http://maven.apache.org/settings.html
 * http://maven.apache.org/components/ref/ - all version reference

create a simple java project
mvn archetype:create -DgroupId=com.lokvin -DartifactId=baseman -DarchetypeArtifactId=maven-archetype-quickstart mvn archetype:generate -DgroupId=me.lokvin.example -DartifactId=SpringExample -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
 * check your ~/m2/settings.xml
 * create project with archetype plugin


 * create a new github repository

touch README.md git init git add. git commit -m "first commit" git remote add origin https://github.com/xxxx/baseman.git git push -u origin master

>cd baseman >mvn eclipse:eclipse
 * make it to eclipse project

mvn archetype

 * http://maven.apache.org/archetype/maven-archetype-plugin/usage.html

mvn download source code
mvn dependency:sources

mvn dependency tree
mvn dependency:tree

settings.xml
     

maven dependency management


Enterprise Maven repository architecture 



Maven Dependency Management 

opensource repository managers

 * http://www.sonatype.com/nexus/product-overview
 * http://archiva.apache.org/index.cgi
 * https://www.jfrog.com/open-source/

maven create spring example project

 * http://projects.spring.io/spring-framework/

mvn archetype:generate -DgroupId=me.lokvin.example -DartifactId=SpringExample -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
 * create empty project

maven dependency scope

 * https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.
 * compile

This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.
 * provided

This scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.
 * runtime

This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases.
 * test

This scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.
 * system

This scope is only used on a dependency of type pom in the  section. It indicates that the specified POM should be replaced with the dependencies in that POM's  section. Since they are replaced, dependencies with a scope of import do not actually participate in limiting the transitivity of a dependency.
 * import (only available in Maven 2.0.9 or later)