Maven

Maven most useful commands

Hot to configure eclipse project 

mvn eclipse:eclipse -DdownloadSources

How to run arbitrary class

mvn exec:java -Dexec.mainClass="com.example.MyClass" -Dexec.args="arg0 arg1"

How to download all the dependencies into chosen folder

mvn dependency:copy-dependencies -DoutputDirectory=dependencies

How to download all dependencies without its dependencies

mvn dependency:copy-dependencies -DexcludeTransitive=true

How to download arbitrary jar from maven repository

mvn dependency:copy -Dartifact="mysql:mysql-connector-java:5.1.32" -DoutputDirectory=.
mvn dependency:copy -Dartifact="mysql:mysql-connector-java:5.1.32" \
-DremoteRepositories=http://repo1.maven.apache.org/maven2 -DoutputDirectory=.
mvn  dependency:copy-dependencies -Dartifact="org.codehaus.groovy:groovy-all:2.1.6" -DoutputDirectory=.

How to install POM file in local repository

mvn install:install -Dpackaging=pom -DfilePom=pom.xml -Dmaven.repo.local=/var/www/archiva/mvnrepo

How to install artifact into local repository with sources

mvn source:jar install

Extras

How to mirror juno metadata p2 repository

eclipse -nosplash -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source http://download.eclipse.org/releases/juno -destination file:/tmp/p2/metadata/juno

What is MavenSession object

Is used as a shared container contains:
  1. container of PlexusContainer type
  2. request of MavenExecutionRequest type
  3. request of MavenExecutionResult type
  4. repositorySession of RepositorySystemSession type
  5. settings of Settings type
  6. executionProperties of Properties type
  7. currentProject of MavenProject type
  8. projects of List<MavenProject> type
  9. allProjects of List<MavenProject> type
  10. topLevelProject of MavenProject type
  11. projectDependencyGraph of ProjectDependencyGraph type
  12. parallel of boolean type
  13. pluginContextsByProjectAndPluginKey of Map<String, Map<String, Map<String, Object>>> type

Tycho

Debugging tycho

Additional debug logs: -Dtycho.debug.resolver=true

Disable lifecycle participation: -Dtycho.mode=maven or -Dm2e.version

Where target plaftorm is computed:

tycho-core:org.eclipse.tycho.core.resolver.DefaultTychoResolver

Brak komentarzy:

Prześlij komentarz