Tuesday, April 2, 2013

Maven POM - Generate Sources JAR

1. To generate the source code jar :

<project>
<build>
 <plugins>
  <plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-source-plugin</artifactId>
 <version>2.1.1</version>
  <executions>
   <execution>
    <id>attach-sources</id>
    <goals>
     <goal>jar</goal>
    </goals>
   </execution>
  </executions>
        </plugin>
    </plgins>
</build>
<project>

2. To download the source code jar from repository :

<project>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <configuration>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </configuration>
        </plugin>
    </plgins>
</build>
<project>

No comments: