User Tools

Site Tools


java:maven

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
java:maven [2014/12/24 10:42]
127.0.0.1 external edit
java:maven [2015/01/26 11:15] (current)
rlunaro
Line 270: Line 270:
  
  
 +===== A simple project for download dependencies only =====
 +
 +
 +This simple project is for download dependencies of the maven central repository easily. Just put the dependency you want to download into the dependencies section of the project and execute ''​mvn package'':​ the dependencies will appear under ''​target/​lib''​ directory.
 +
 +<code xml>
 +
 +<project xmlns="​http://​maven.apache.org/​POM/​4.0.0"​ xmlns:​xsi="​http://​www.w3.org/​2001/​XMLSchema-instance"​
 +  xsi:​schemaLocation="​http://​maven.apache.org/​POM/​4.0.0 http://​maven.apache.org/​xsd/​maven-4.0.0.xsd">​
 +  <​modelVersion>​4.0.0</​modelVersion>​
 +
 +  <!--
 +  ​
 +  mvn package ​           -> creates the jar file and copies the dependencies into target/lib
 +  ​
 +  -->
 +  ​
 +  <​groupId>​com.mycompany.app</​groupId>​
 +  <​artifactId>​my-app</​artifactId>​
 +  <​version>​1.0-SNAPSHOT</​version>​
 +  <​packaging>​jar</​packaging>​
 +
 +  <​name>​Maven Quick Start Archetype</​name>​
 +  <​url>​http://​maven.apache.org</​url>​
 +
 +  <​dependencies>​
 +    <​dependency>​
 +        <​groupId>​org.springframework</​groupId>​
 +        <​artifactId>​spring-context</​artifactId>​
 +        <​version>​4.1.4.RELEASE</​version>​
 +    <​scope>​test</​scope>​
 +    </​dependency>​
 +  </​dependencies>​
 +  ​
 +  <​build>​
 +  <​plugins>​
 +    <!--
 +
 +        dependency plugin: copy all the dependencies into the target/lib directory
 +   ​
 +   -->
 +      <​plugin>​
 +          <​groupId>​org.apache.maven.plugins</​groupId>​
 +          <​artifactId>​maven-dependency-plugin</​artifactId>​
 +          <​version>​2.7</​version>​
 +          <​executions>​
 +              <​execution>​
 +                  <​id>​copy-dependencies</​id>​
 +                  <​phase>​package</​phase>​
 +                  <​goals>​
 +                    <​goal>​copy-dependencies</​goal>​
 +                  </​goals>​
 +                  <​configuration>​
 +                      <​outputDirectory>​${project.build.directory}/​lib</​outputDirectory>​
 +                  </​configuration>​
 +              </​execution>​
 +          </​executions>​
 +      </​plugin>​
 +
 +  </​plugins>​
 +  ​
 +  ​
 +    <​pluginManagement>​
 +        <​plugins>​
 +            <​plugin>​
 +              <​groupId>​org.eclipse.m2e</​groupId>​
 +              <​artifactId>​lifecycle-mapping</​artifactId>​
 +              <​version>​1.0.0</​version>​
 +              ​
 +              <​configuration>​
 +                <​lifecycleMappingMetadata>​
 +                    <​pluginExecutions>​
 +                        <​pluginExecution>​
 +                            <​pluginExecutionFilter>​
 +  ​         <​groupId>​org.apache.maven.plugins</​groupId>​
 +  ​         <​artifactId>​maven-dependency-plugin</​artifactId>​
 +  ​         <​versionRange>​[2.0,​)</​versionRange>​
 +  ​         <​goals>​
 +  ​             <​goal>​copy-dependencies</​goal>​
 +  ​         </​goals> ​                       ​
 +                            </​pluginExecutionFilter>​
 +                            <​action>​
 +                                <​execute/>​
 +                            </​action>​
 +                        </​pluginExecution>​
 +                    </​pluginExecutions>​
 +                </​lifecycleMappingMetadata>​
 +              </​configuration>​
 +              ​
 +            </​plugin> ​       ​
 +        </​plugins>​
 +    </​pluginManagement> ​   ​
 +  ​
 +  ​
 +  </​build>​
 +</​project>​
 +
 +
 +</​code>​
  
  
java/maven.txt ยท Last modified: 2015/01/26 11:15 by rlunaro