Lifecycle and plugins in maven

an introduction
The life cycle includes: clean, compile, test, package, install
 
Two complete project construction process
Clean, Edit, Test, Package, Integration Test, Validate, Deploy
 
Three maven life cycle
clean: clean up the project
    pre-clean: perform pre-clean work
    clean: clean up all files generated by the previous build
    post-clean: Execute cleaned files
default: build the project (the most core)
     compile、test、package、install
site: Generate project site
    pre-site: work to be done before generating the project site
    site: Generates site documentation for the project
    post-site: work to be done after generating the project site
    site-deploy: Publish the generated site to the server
 
Four maven official website provides a lot of plug-ins
 
5. Use the source plugin
Edit pom.xml
  < build >
        < plugins >
               < plugin >
                       < groupId > org.apache.maven.plugins </ groupId >
                    < artifactId > maven -source- plugin </ artifactId >
                    < version > 2.4 </ version >
                    < executions >
                      < execution >
                             < phase > package </ phase >
                             < goals >
                                    < goal > jar-no-fork </ goal >
                             </ goals >
                      </ execution >
                    </ executions >
               </ plugin >
        </ plugins >
  </ build >
run


 
The result is as follows:

 

[INFO] Building jar: F:\java\Workspaces_MyEclipse10\hi\target\hi-0.0.1-SNAPSHOT-sources.jar

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326853320&siteId=291194637