Maven2交流

ChangQi Lin
ChangQi LinSenior Engineer em AsiaInfo
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
1 de 33

Recomendados

[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso... por
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...ZeroTurnaround
90K visualizações15 slides
An introduction to maven gradle and sbt por
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbtFabio Fumarola
8.2K visualizações45 slides
Gradle Introduction por
Gradle IntroductionGradle Introduction
Gradle IntroductionDmitry Buzdin
7.8K visualizações39 slides
Jenkins 2.0 最新事情 〜Make Jenkins Great Again〜 por
Jenkins 2.0 最新事情 〜Make Jenkins Great Again〜Jenkins 2.0 最新事情 〜Make Jenkins Great Again〜
Jenkins 2.0 最新事情 〜Make Jenkins Great Again〜Jumpei Miyata
7.4K visualizações92 slides
Antons Kranga Building Agile Infrastructures por
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile InfrastructuresAntons Kranga
1.8K visualizações72 slides
Gradle 3.0: Unleash the Daemon! por
Gradle 3.0: Unleash the Daemon!Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Eric Wendelin
2.8K visualizações47 slides

Mais conteúdo relacionado

Mais procurados

Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf... por
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...Puppet
5K visualizações51 slides
jbang: Unleash the power of Java for shell scripting por
jbang: Unleash the power of Java for shell scriptingjbang: Unleash the power of Java for shell scripting
jbang: Unleash the power of Java for shell scriptingRed Hat Developers
2.8K visualizações34 slides
SBT Crash Course por
SBT Crash CourseSBT Crash Course
SBT Crash CourseMichal Bigos
5.9K visualizações30 slides
Automated Infrastructure Testing por
Automated Infrastructure TestingAutomated Infrastructure Testing
Automated Infrastructure TestingRanjib Dey
7.7K visualizações58 slides
Continuous Delivery in Enterprise Environments using Docker, Ansible and Jenkins por
Continuous Delivery in Enterprise Environments using Docker, Ansible and JenkinsContinuous Delivery in Enterprise Environments using Docker, Ansible and Jenkins
Continuous Delivery in Enterprise Environments using Docker, Ansible and JenkinsMarcel Birkner
2.9K visualizações45 slides
Ship your Scala code often and easy with Docker por
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerMarcus Lönnberg
4.3K visualizações41 slides

Mais procurados(20)

Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf... por Puppet
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Puppet5K visualizações
jbang: Unleash the power of Java for shell scripting por Red Hat Developers
jbang: Unleash the power of Java for shell scriptingjbang: Unleash the power of Java for shell scripting
jbang: Unleash the power of Java for shell scripting
Red Hat Developers2.8K visualizações
SBT Crash Course por Michal Bigos
SBT Crash CourseSBT Crash Course
SBT Crash Course
Michal Bigos5.9K visualizações
Automated Infrastructure Testing por Ranjib Dey
Automated Infrastructure TestingAutomated Infrastructure Testing
Automated Infrastructure Testing
Ranjib Dey7.7K visualizações
Continuous Delivery in Enterprise Environments using Docker, Ansible and Jenkins por Marcel Birkner
Continuous Delivery in Enterprise Environments using Docker, Ansible and JenkinsContinuous Delivery in Enterprise Environments using Docker, Ansible and Jenkins
Continuous Delivery in Enterprise Environments using Docker, Ansible and Jenkins
Marcel Birkner2.9K visualizações
Ship your Scala code often and easy with Docker por Marcus Lönnberg
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
Marcus Lönnberg4.3K visualizações
Jabox presentation por spiddy
Jabox presentationJabox presentation
Jabox presentation
spiddy1K visualizações
Continous delivery with sbt por Wojciech Pituła
Continous delivery with sbtContinous delivery with sbt
Continous delivery with sbt
Wojciech Pituła2.3K visualizações
Building scala with bazel por Natan Silnitsky
Building scala with bazelBuilding scala with bazel
Building scala with bazel
Natan Silnitsky1.4K visualizações
How to push to production a project with 100+ plugins in less than 10 minutes por Thiago Leão Moreira
How to push to production a project with 100+ plugins in less than 10 minutes How to push to production a project with 100+ plugins in less than 10 minutes
How to push to production a project with 100+ plugins in less than 10 minutes
Thiago Leão Moreira826 visualizações
Gradle in 45min por Schalk Cronjé
Gradle in 45minGradle in 45min
Gradle in 45min
Schalk Cronjé1.6K visualizações
Jazoon12 355 aleksandra_gavrilovska-1 por Netcetera
Jazoon12 355 aleksandra_gavrilovska-1Jazoon12 355 aleksandra_gavrilovska-1
Jazoon12 355 aleksandra_gavrilovska-1
Netcetera1.6K visualizações
Jenkins Pipelines por Steffen Gebert
Jenkins PipelinesJenkins Pipelines
Jenkins Pipelines
Steffen Gebert10.1K visualizações
State of the Jenkins Automation por Julien Pivotto
State of the Jenkins AutomationState of the Jenkins Automation
State of the Jenkins Automation
Julien Pivotto5.6K visualizações
Jenkins and Groovy por Kiyotaka Oku
Jenkins and GroovyJenkins and Groovy
Jenkins and Groovy
Kiyotaka Oku2.7K visualizações
JavaOne 2016 - Pipeline as code por Bert Jan Schrijver
JavaOne 2016 - Pipeline as codeJavaOne 2016 - Pipeline as code
JavaOne 2016 - Pipeline as code
Bert Jan Schrijver750 visualizações
Testing the Enterprise layers, with Arquillian por Virtual JBoss User Group
Testing the Enterprise layers, with ArquillianTesting the Enterprise layers, with Arquillian
Testing the Enterprise layers, with Arquillian
Virtual JBoss User Group2.7K visualizações
Containerizing a Web Application with Vue.js and Java por Jadson Santos
Containerizing a Web Application with Vue.js and JavaContainerizing a Web Application with Vue.js and Java
Containerizing a Web Application with Vue.js and Java
Jadson Santos346 visualizações
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013 por Carlos Sanchez
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Carlos Sanchez16.9K visualizações
Jenkins days workshop pipelines - Eric Long por ericlongtx
Jenkins days workshop  pipelines - Eric LongJenkins days workshop  pipelines - Eric Long
Jenkins days workshop pipelines - Eric Long
ericlongtx1.8K visualizações

Destaque

Minäkö johtajaksi por
Minäkö johtajaksiMinäkö johtajaksi
Minäkö johtajaksijaluopo
167 visualizações6 slides
Television digital-12131 por
Television digital-12131Television digital-12131
Television digital-12131Cynthia Correa
494 visualizações10 slides
Web 2.0 por
Web 2.0Web 2.0
Web 2.0tmarin0716
270 visualizações14 slides
Viena 2184 por
Viena 2184Viena 2184
Viena 2184Cotizalia
152 visualizações30 slides
10 Insightful Quotes On Designing A Better Customer Experience por
10 Insightful Quotes On Designing A Better Customer Experience10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer ExperienceYuan Wang
1.3M visualizações26 slides
SEO: Getting Personal por
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting PersonalKirsty Hulse
432.5K visualizações35 slides

Destaque(8)

Minäkö johtajaksi por jaluopo
Minäkö johtajaksiMinäkö johtajaksi
Minäkö johtajaksi
jaluopo167 visualizações
Television digital-12131 por Cynthia Correa
Television digital-12131Television digital-12131
Television digital-12131
Cynthia Correa494 visualizações
Web 2.0 por tmarin0716
Web 2.0Web 2.0
Web 2.0
tmarin0716270 visualizações
Viena 2184 por Cotizalia
Viena 2184Viena 2184
Viena 2184
Cotizalia152 visualizações
10 Insightful Quotes On Designing A Better Customer Experience por Yuan Wang
10 Insightful Quotes On Designing A Better Customer Experience10 Insightful Quotes On Designing A Better Customer Experience
10 Insightful Quotes On Designing A Better Customer Experience
Yuan Wang1.3M visualizações
SEO: Getting Personal por Kirsty Hulse
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
Kirsty Hulse432.5K visualizações
How to Build a Dynamic Social Media Plan por Post Planner
How to Build a Dynamic Social Media PlanHow to Build a Dynamic Social Media Plan
How to Build a Dynamic Social Media Plan
Post Planner409K visualizações

Similar a Maven2交流

Maven por
MavenMaven
MavenChas Honton
38 visualizações27 slides
Maven por
MavenMaven
MavenМарія Русин
1.9K visualizações49 slides
Apache maven, a software project management tool por
Apache maven, a software project management toolApache maven, a software project management tool
Apache maven, a software project management toolRenato Primavera
1.6K visualizações57 slides
Maven por
MavenMaven
MavenShraddha
416 visualizações24 slides
Liferay maven sdk por
Liferay maven sdkLiferay maven sdk
Liferay maven sdkMika Koivisto
3.2K visualizações20 slides
Learning Maven by Example por
Learning Maven by ExampleLearning Maven by Example
Learning Maven by ExampleHsi-Kai Wang
1.6K visualizações42 slides

Similar a Maven2交流(20)

Maven por Chas Honton
MavenMaven
Maven
Chas Honton38 visualizações
Apache maven, a software project management tool por Renato Primavera
Apache maven, a software project management toolApache maven, a software project management tool
Apache maven, a software project management tool
Renato Primavera1.6K visualizações
Maven por Shraddha
MavenMaven
Maven
Shraddha416 visualizações
Liferay maven sdk por Mika Koivisto
Liferay maven sdkLiferay maven sdk
Liferay maven sdk
Mika Koivisto3.2K visualizações
Learning Maven by Example por Hsi-Kai Wang
Learning Maven by ExampleLearning Maven by Example
Learning Maven by Example
Hsi-Kai Wang1.6K visualizações
Java Builds with Maven and Ant por David Noble
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and Ant
David Noble2.4K visualizações
Java build tools por Sujit Kumar
Java build toolsJava build tools
Java build tools
Sujit Kumar79 visualizações
Intelligent Projects with Maven - DevFest Istanbul por Mert Çalışkan
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
Mert Çalışkan1.3K visualizações
Apache Maven por venkatraghavang
Apache MavenApache Maven
Apache Maven
venkatraghavang461 visualizações
Gradle - time for a new build por Igor Khotin
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
Igor Khotin6.2K visualizações
Webinar: Creating an Effective Docker Build Pipeline for Java Apps por Codefresh
Webinar: Creating an Effective Docker Build Pipeline for Java AppsWebinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
Codefresh473 visualizações
Introduction To Maven2 por Shuji Watanabe
Introduction To Maven2Introduction To Maven2
Introduction To Maven2
Shuji Watanabe1.7K visualizações
BMO - Intelligent Projects with Maven por Mert Çalışkan
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
Mert Çalışkan1.6K visualizações
Introduction to maven por Manos Georgopoulos
Introduction to mavenIntroduction to maven
Introduction to maven
Manos Georgopoulos1.2K visualizações
maven por akd11
mavenmaven
maven
akd11375 visualizações
Maven Basics - Explained por Smita Prasad
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
Smita Prasad1.1K visualizações
Introduction to maven, its configuration, lifecycle and relationship to JS world por Dmitry Bakaleinik
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS world
Dmitry Bakaleinik691 visualizações
Maven por Fabio Bonfante
MavenMaven
Maven
Fabio Bonfante829 visualizações
Maven basic concept por Ming-Sian Lin
Maven basic conceptMaven basic concept
Maven basic concept
Ming-Sian Lin843 visualizações

Maven2交流

  • 1. Email lcycenter@gmail.com
  • 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