Your SlideShare is downloading. ×
Maven - Tips & tricks
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Maven - Tips & tricks

5,932
views

Published on

Published in: Technology, Art & Photos

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,932
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Tips & Tricks April 8, 2011 Mickaël Tricot "FRIDAY"
  • 2. From Maven 2 to Maven 3
      • Maven 3 released in October 2010
    •  
      • Backward compatibility... but
        • Maven 1 repositories no longer supported
        • A few side effects may happen
    •  
      • "Harder better faster stronger"
        • Stricter: all plugin versions required
        • Faster: multithreaded, multicore
  • 3. Repositories
      • Repository in Europe: http://uk.maven.org/maven2/
      •  
      •  
    •  
    •  
    •  
      • Search engine: http://mavencentral.sonatype.com/
  • 4. Dependencies
      • "When you have a set of projects that inherits a common parent it's possible to put all information about the dependency in the common POM and have simpler references to the artifacts in the child POMs."
    •  
      • Root POM <dependencyManagement>  
        • specifies <groupId>, <artifactId>, <version>, <scope>, <exclusions> ...
      • Module POMs <dependencies>  
        • should only specify <groupId> , <artifactId>
  • 5. Plugins
      • Root POM <pluginManagement>  
        • specifies <groupId>, <artifactId>, <version>
        • common <configuration> ...
      • Module POMs <dependencies>  
        • should only specify <groupId> , <artifactId>  
        • specific <configuration>
  • 6. Properties
      • Use properties for values which
        • might change in the future
        • are used in several places
      • Like
        • All dependency and plugin versions
        • Some settings
    •  
      •   Some properties are already built-in <project.build.sourceEncoding>   UTF-8 </project.build.sourceEncoding>
    •  
  • 7. Options
      • Debug mvn install -X
    •  
      • Work offline: -o, --offline mvn install -o
      • Specify reactor projects: -pl, --projects mvn install -pl data,services,web
    •  
      • Thread count : -T, --threads mvn install -T2C (2 threads per core )
  • 8. Help plugin
      • Display the effective POM
      • mvn help:effective-pom
  • 9. Dependency plugin
      • Show the dependencies which are used and undeclared or unused and declared /!
      • mvn dependency:analyze
      • Resolve dependencies/plugins/reports before going offline
      • mvn dependency:go-offline
    •  
      • Display the dependency tree
      • mvn dependency:tree -Dincludes=javax.jcr
  • 10. Versions plugin
      • Report dependencies with newer versions available /!
      • mvn versions:display-dependency-updates
    •  
      • Report plugins with newer versions available
      • mvn versions:display-plugin-updates
      •  
      • Set the project version
      • mvn versions:set -DnewVersion=1.2
    •  
  • 11. Convention over configuration
    •  
    • &quot;Do not be smart!&quot;
    •  
  • 12. Resources
      • Sonatype book http://www.sonatype.com/books/maven-book/
    •  
      • Maven 3 compatibility notes http://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html
    •  
      • Repository in Europe http://uk.maven.org/maven2/  
    •  
      • Search engine http://mavencentral.sonatype.com/
    •  
      • Help plugin http://maven.apache.org/plugins/maven-help-plugin/
    •  
      • Dependency plugin http://maven.apache.org/plugins/maven-dependency-plugin/
    •  
      • Versions plugin http://mojo.codehaus.org/versions-maven-plugin/

×