SlideShare a Scribd company logo
Email   lcycenter@gmail.com
}    Maven2
}    Maven2
}    Maven2
}    Maven2
      ◦ 
      ◦ 
      ◦ 
      ◦ 
      ◦ 
}         Maven2
      ◦  Maven2
      ◦  Maven2     Ant
      ◦  Maven2           Ant
} 
      ◦ 
      ◦ 
      ◦          Eclipse/Netbean/IntelliJ IDEA/…
      ◦                 maven
} 
      ◦ 
           –     ->     ->   ->        ->
      ◦  ANT
      ◦      ANT
      ◦ 
           –  Tomcat/Jetty
           – 
           – 
} 
}         &
      ◦     JAR
      ◦ 
} 
      ◦    IDE
      ◦ 
Maven2交流
Maven2交流
Maven2交流
} 
} 
} 

} 
}    (Goals)
}    (archetype)
groupId:artifactId:packaging:version
pom.xml
Project1

           pom.xml



Project2

            pom.xml




Project3
}               public / private / locale / …
}    Maven
      ◦            (POM.xml + JAR/WAR)
      ◦             Maven
      ◦  /<groupId>/<artifactId>/<version>/<artifactId>-
         <version>.<packaging>
       –  org.apache.commons:commons-email:1.1
       –  /org/apache/commons/commons-email/1.1/
}    mvn install
}    Maven
      ◦  http://repository.sonatype.org/index.html
      ◦  http://www.mvnbrowser.com/
      ◦  http://www.mvnrepository.com/
<dependencies>
 <dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>3.8.1</version>
  <scope>test</scope>
 </dependency>                     Scope
</dependencies>                    • compile
                                   • provided
}                                 • test
}               JAR               • runtime
                                   • system
Maven2交流
validate                  validate the project is correct and all necessary information is
                          available.
generate-sources          generate any source code for inclusion in compilation

process-sources           process the source code, for example to filter any values

generate-resources        generate resources for inclusion in the package.

process-resources         copy and process the resources into the destination directory,
                          ready for packaging.
compile                   compile the source code of the project.

process-classes           post-process the generated files from compilation, for
                          example to do bytecode enhancement on Java classes.
generate-test-sources     generate any test source code for inclusion in compilation

process-test-sources      process the test source code, for example to filter any values.

generate-test-resources   create resources for testing.
process-test-           copy and process the resources into the test destination directory.
resources
test-compile            compile the test source code into the test destination directory

test                    run tests using a suitable unit testing framework. These tests
                        should not require the code be packaged or deployed
package                 take the compiled code and package it in its distributable format,
                        such as a JAR.
pre-integration-test    perform actions required before integration tests are executed. This
                        may involve things such as setting up the required environment.
integration-test        process and deploy the package if necessary into an environment
                        where integration tests can be run.
post-integration-test   perform actions required after integration tests have been executed.
                        This may including cleaning up the environment
verify                  run any checks to verify the package is valid and meets quality
                        criteria.
install                 install the package into the local repository, for use as a
                        dependency in other projects locally.
deploy                  done in an integration or release environment, copies the final
                        package to the remote repository for sharing with other developers
                        and projects.
} 
}    Maven =   +
} 

} 




                $mvn jar:jar
                $mvn archetype:create …
Maven2交流
}  mvn compile
}  mvn clean
}  mvn test

}  mvn package
}  mvn install

}  Mvn jetty:run
}  mvn javadoc:javadoc
}  mvn site

}  …
}    Maven2
}    Maven2
}    Maven2
}         Maven   apache-maven-2.1.0-bin.zip
}    2.
        %DEV_HOME%tools
}  3.            M2_HOME %DEV_HOME%
    toolsapache-maven-2.1.0
}  4.            M2: %M2_HOME%bin
}  5.  %M2%       Path
}  6.     CMD          c:mvn --version
}    Maven2
}    Maven2
}    Maven2
}       Builds
}       Documentation
}    Reporting
}       Dependencies
}       SCMs
}       Releases
}    Maven2
      ◦  EAR
      ◦  WAR
      ◦  JAR
      ◦  ZIP
      ◦  EJB
} 
}    mvn archetype:create -
      DgroupId=com.mycompany.ap -
      DartifactId=my-app
      ◦ 
           –  -DgroupId=
           –  -DartifactId=
Maven2交流
src/main/java        Application/Library sources
src/main/resources   Application/Library resources
src/main/webapps     Web application sources
src/test/java        Test sources
src/test/resources   Test resources
src/site             Site
LICENSE.txt          Project's license
README.txt           Project's readme
} 
}    Maven2

} 
} 
}                    ebiz-app
}        Java Package      com.xxxx.ebiz
} 
      ◦  app-util(jar):
      ◦  app-dao(jar): model / dao / ibatis
      ◦  app-web-common(jar)
      ◦  app-web-portal(war):
      ◦  app-web-console(war):
Maven2交流
}        Plugin    m2eclipse
} 
      ◦ 
      ◦  Coding
      ◦  mvn test
      ◦  mvn jetty:run
      ◦  Code Checkin
      ◦  mvn package
      ◦  mvn install
Maven2交流
}  mvn   compile
}  mvn   test
}  mvn   package
}  mvn   install
}  mvn   jetty:run

More Related Content

PDF
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
ZeroTurnaround
 
PPT
An introduction to maven gradle and sbt
Fabio Fumarola
 
PDF
Gradle Introduction
Dmitry Buzdin
 
PDF
Jenkins 2.0 最新事情 〜Make Jenkins Great Again〜
Jumpei Miyata
 
PDF
Antons Kranga Building Agile Infrastructures
Antons Kranga
 
PDF
Gradle 3.0: Unleash the Daemon!
Eric Wendelin
 
PDF
Simple Build Tool
David Galichet
 
PPT
Continuos integration for iOS projects
Aleksandra Gavrilovska
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
ZeroTurnaround
 
An introduction to maven gradle and sbt
Fabio Fumarola
 
Gradle Introduction
Dmitry Buzdin
 
Jenkins 2.0 最新事情 〜Make Jenkins Great Again〜
Jumpei Miyata
 
Antons Kranga Building Agile Infrastructures
Antons Kranga
 
Gradle 3.0: Unleash the Daemon!
Eric Wendelin
 
Simple Build Tool
David Galichet
 
Continuos integration for iOS projects
Aleksandra Gavrilovska
 

What's hot (19)

PDF
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Puppet
 
PDF
jbang: Unleash the power of Java for shell scripting
Red Hat Developers
 
PDF
SBT Crash Course
Michal Bigos
 
PPTX
Automated Infrastructure Testing
Ranjib Dey
 
PDF
Continuous Delivery in Enterprise Environments using Docker, Ansible and Jenkins
Marcel Birkner
 
PDF
Ship your Scala code often and easy with Docker
Marcus Lönnberg
 
ODP
Jabox presentation
spiddy
 
PDF
Continous delivery with sbt
Wojciech Pituła
 
PDF
Building scala with bazel
Natan Silnitsky
 
PPTX
How to push to production a project with 100+ plugins in less than 10 minutes
Thiago Leão Moreira
 
PDF
Gradle in 45min
Schalk Cronjé
 
PDF
Jazoon12 355 aleksandra_gavrilovska-1
Netcetera
 
PDF
Jenkins Pipelines
Steffen Gebert
 
PDF
Jenkins and Groovy
Kiyotaka Oku
 
PDF
JavaOne 2016 - Pipeline as code
Bert Jan Schrijver
 
PDF
Testing the Enterprise layers, with Arquillian
Virtual JBoss User Group
 
PDF
Containerizing a Web Application with Vue.js and Java
Jadson Santos
 
PDF
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Carlos Sanchez
 
PPTX
Jenkins days workshop pipelines - Eric Long
ericlongtx
 
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Puppet
 
jbang: Unleash the power of Java for shell scripting
Red Hat Developers
 
SBT Crash Course
Michal Bigos
 
Automated Infrastructure Testing
Ranjib Dey
 
Continuous Delivery in Enterprise Environments using Docker, Ansible and Jenkins
Marcel Birkner
 
Ship your Scala code often and easy with Docker
Marcus Lönnberg
 
Jabox presentation
spiddy
 
Continous delivery with sbt
Wojciech Pituła
 
Building scala with bazel
Natan Silnitsky
 
How to push to production a project with 100+ plugins in less than 10 minutes
Thiago Leão Moreira
 
Gradle in 45min
Schalk Cronjé
 
Jazoon12 355 aleksandra_gavrilovska-1
Netcetera
 
Jenkins Pipelines
Steffen Gebert
 
Jenkins and Groovy
Kiyotaka Oku
 
JavaOne 2016 - Pipeline as code
Bert Jan Schrijver
 
Testing the Enterprise layers, with Arquillian
Virtual JBoss User Group
 
Containerizing a Web Application with Vue.js and Java
Jadson Santos
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Carlos Sanchez
 
Jenkins days workshop pipelines - Eric Long
ericlongtx
 
Ad

Viewers also liked (8)

PPTX
Minäkö johtajaksi
jaluopo
 
PPT
Television digital-12131
Cynthia Correa
 
PPS
Web 2.0
tmarin0716
 
PPS
Viena 2184
Cotizalia
 
PDF
10 Insightful Quotes On Designing A Better Customer Experience
Yuan Wang
 
PDF
SEO: Getting Personal
Kirsty Hulse
 
PDF
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Stanford GSB Corporate Governance Research Initiative
 
PPTX
How to Build a Dynamic Social Media Plan
Post Planner
 
Minäkö johtajaksi
jaluopo
 
Television digital-12131
Cynthia Correa
 
Web 2.0
tmarin0716
 
Viena 2184
Cotizalia
 
10 Insightful Quotes On Designing A Better Customer Experience
Yuan Wang
 
SEO: Getting Personal
Kirsty Hulse
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Stanford GSB Corporate Governance Research Initiative
 
How to Build a Dynamic Social Media Plan
Post Planner
 
Ad

Similar to Maven2交流 (20)

PPTX
Maven
Chas Honton
 
PDF
Apache maven, a software project management tool
Renato Primavera
 
PPTX
Maven
Shraddha
 
PDF
Liferay maven sdk
Mika Koivisto
 
PPTX
Learning Maven by Example
Hsi-Kai Wang
 
PDF
Java Builds with Maven and Ant
David Noble
 
PPTX
Java build tools
Sujit Kumar
 
PDF
Intelligent Projects with Maven - DevFest Istanbul
Mert Çalışkan
 
PPTX
Apache Maven
venkatraghavang
 
PDF
Gradle - time for a new build
Igor Khotin
 
PDF
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
Codefresh
 
KEY
Introduction To Maven2
Shuji Watanabe
 
PDF
BMO - Intelligent Projects with Maven
Mert Çalışkan
 
PPTX
Introduction to maven
Manos Georgopoulos
 
PPTX
Introduction to Maven for beginners and DevOps
SISTechnologies
 
PDF
maven
akd11
 
PPTX
Maven Basics - Explained
Smita Prasad
 
PDF
Introduction to maven, its configuration, lifecycle and relationship to JS world
Dmitry Bakaleinik
 
ODP
Maven
Fabio Bonfante
 
Apache maven, a software project management tool
Renato Primavera
 
Maven
Shraddha
 
Liferay maven sdk
Mika Koivisto
 
Learning Maven by Example
Hsi-Kai Wang
 
Java Builds with Maven and Ant
David Noble
 
Java build tools
Sujit Kumar
 
Intelligent Projects with Maven - DevFest Istanbul
Mert Çalışkan
 
Apache Maven
venkatraghavang
 
Gradle - time for a new build
Igor Khotin
 
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
Codefresh
 
Introduction To Maven2
Shuji Watanabe
 
BMO - Intelligent Projects with Maven
Mert Çalışkan
 
Introduction to maven
Manos Georgopoulos
 
Introduction to Maven for beginners and DevOps
SISTechnologies
 
maven
akd11
 
Maven Basics - Explained
Smita Prasad
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Dmitry Bakaleinik
 

Maven2交流

  • 2. }  Maven2 }  Maven2 }  Maven2
  • 3. }  Maven2 ◦  ◦  ◦  ◦  ◦  }  Maven2 ◦  Maven2 ◦  Maven2 Ant ◦  Maven2 Ant
  • 4. }  ◦  ◦  ◦  Eclipse/Netbean/IntelliJ IDEA/… ◦  maven }  ◦  –  -> -> -> -> ◦  ANT ◦  ANT ◦  –  Tomcat/Jetty –  –  } 
  • 5. }  & ◦  JAR ◦  }  ◦  IDE ◦ 
  • 9. }  }  }  }  }  (Goals) }  (archetype)
  • 11. pom.xml Project1 pom.xml Project2 pom.xml Project3
  • 12. }  public / private / locale / … }  Maven ◦  (POM.xml + JAR/WAR) ◦  Maven ◦  /<groupId>/<artifactId>/<version>/<artifactId>- <version>.<packaging> –  org.apache.commons:commons-email:1.1 –  /org/apache/commons/commons-email/1.1/ }  mvn install }  Maven ◦  http://repository.sonatype.org/index.html ◦  http://www.mvnbrowser.com/ ◦  http://www.mvnrepository.com/
  • 13. <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> Scope </dependencies> • compile • provided }  • test }  JAR • runtime • system
  • 15. validate validate the project is correct and all necessary information is available. generate-sources generate any source code for inclusion in compilation process-sources process the source code, for example to filter any values generate-resources generate resources for inclusion in the package. process-resources copy and process the resources into the destination directory, ready for packaging. compile compile the source code of the project. process-classes post-process the generated files from compilation, for example to do bytecode enhancement on Java classes. generate-test-sources generate any test source code for inclusion in compilation process-test-sources process the test source code, for example to filter any values. generate-test-resources create resources for testing.
  • 16. process-test- copy and process the resources into the test destination directory. resources test-compile compile the test source code into the test destination directory test run tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed package take the compiled code and package it in its distributable format, such as a JAR. pre-integration-test perform actions required before integration tests are executed. This may involve things such as setting up the required environment. integration-test process and deploy the package if necessary into an environment where integration tests can be run. post-integration-test perform actions required after integration tests have been executed. This may including cleaning up the environment verify run any checks to verify the package is valid and meets quality criteria. install install the package into the local repository, for use as a dependency in other projects locally. deploy done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
  • 17. }  }  Maven = + }  }  $mvn jar:jar $mvn archetype:create …
  • 19. }  mvn compile }  mvn clean }  mvn test }  mvn package }  mvn install }  Mvn jetty:run }  mvn javadoc:javadoc }  mvn site }  …
  • 20. }  Maven2 }  Maven2 }  Maven2
  • 21. }  Maven apache-maven-2.1.0-bin.zip }  2. %DEV_HOME%tools }  3. M2_HOME %DEV_HOME% toolsapache-maven-2.1.0 }  4. M2: %M2_HOME%bin }  5. %M2% Path }  6. CMD c:mvn --version
  • 22. }  Maven2 }  Maven2 }  Maven2
  • 23. }  Builds }  Documentation }  Reporting }  Dependencies }  SCMs }  Releases
  • 24. }  Maven2 ◦  EAR ◦  WAR ◦  JAR ◦  ZIP ◦  EJB
  • 25. }  }  mvn archetype:create - DgroupId=com.mycompany.ap - DartifactId=my-app ◦  –  -DgroupId= –  -DartifactId=
  • 27. src/main/java Application/Library sources src/main/resources Application/Library resources src/main/webapps Web application sources src/test/java Test sources src/test/resources Test resources src/site Site LICENSE.txt Project's license README.txt Project's readme
  • 28. }  }  Maven2 }  } 
  • 29. }  ebiz-app }  Java Package com.xxxx.ebiz }  ◦  app-util(jar): ◦  app-dao(jar): model / dao / ibatis ◦  app-web-common(jar) ◦  app-web-portal(war): ◦  app-web-console(war):
  • 31. }  Plugin m2eclipse }  ◦  ◦  Coding ◦  mvn test ◦  mvn jetty:run ◦  Code Checkin ◦  mvn package ◦  mvn install
  • 33. }  mvn compile }  mvn test }  mvn package }  mvn install }  mvn jetty:run