LEARNING SUMMARY
Start learning maven, summarized some main features of the maven
1, how does maven differs from tradition build tools
Maven uses project description information (pom.xml) to manage project build, test and report
Maven provides a convenient way of publish project information and share JAR among project.
Thus enables manage different version of source code write by different person.
Maven is more than a build tool,it is a standard way to think about project layout and management
Maven project has a standard directory structure
Maven plugin is a set of similar goals
After running mvn install , a series of goals will be executed until the project lifecycle finished , during this project lifecycle maven has done a lot of work like compile, download decency, create JAR.
2, POM.XML : metadata tells maven about the project , some important fields
<artifactid> the id of the project output
<dependency> specify the JAR artifacts project depend on
<repository> associate the project with a source code repository for maven source code control (SCM) to use.
<sourceDirectory> specify the location of project source code
<resource> specify the configuration files to be copied in JAR ( .property .xml configuration files)
3, how to create a maven web app project
Use maven archetype plug in to specify web app project archetype and specify the arificateid, groupid.
mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp write java source code in src/main/resources folder write web configuration files in src/main/webapp/web-inf folders PROJECT PROGRESS
Try to Migrating the ant project created in spring tutorial to maven
Encounter a problem that maven can’t download the dependent artifacts from centre repository,
Read through the maven developer’s notebook again and find out that I need to set a proxy for maven. Add the entry <proxy>…</proxy> entry in the settings.xml file in .m2 folder then problem resolved.