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 revisionPrevious revision
Next revision
Previous revision
java:maven [2014/12/24 10:42] – external edit 127.0.0.1java:maven [2022/12/02 22:02] (current) – external edit 127.0.0.1
Line 6: Line 6:
 Hi, these are my notes on Maven. Probably here are a lot of inaccuracies, because I am using this to clarify myself and to help me to order my mind in the process of using this tool in my projects.  Hi, these are my notes on Maven. Probably here are a lot of inaccuracies, because I am using this to clarify myself and to help me to order my mind in the process of using this tool in my projects. 
  
- 
- 
-I've came across a fantastic book: //Maven, the definitive guide//. Absolutely recommendable. Here is the link to amazon:  
- 
-http://www.amazon.com/Maven-Definitive-Guide-Sonatype-Company/dp/144936280X/ref=sr_1_3?ie=UTF8&qid=1363040267&sr=8-3&keywords=maven%2C+the+definitive+guide 
  
  
Line 270: Line 265:
  
  
 +===== 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.1419414127.txt.gz · Last modified: 2022/12/02 22:02 (external edit)