Maven Download Sources with the Class JAR Files: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:
* [[Maven_dependency_Plugin#Download_Sources_with_the_Class_JAR_Files|dependency Plugin]]
* [[Maven_dependency_Plugin#Download_Sources_with_the_Class_JAR_Files|dependency Plugin]]
* [[Maven#Subjects|Maven Subjects]]
* [[Maven#Subjects|Maven Subjects]]
* [[Maven_Concepts#Type|Artifact type]]
=Options=
1. Explicit in the <dependencies> section of the POM.
<font color=red>Not tested.</font>
Explicitly specify the "java-source" artifact type along with the default type dependency:
<dependency>
  <groupId>io.example</groupId>
  <artifactId>blue</artifactId>
  <version>1.0</version>
</dependency>
<dependency>
  <groupId>io.example</groupId>
  <artifactId>blue</artifactId>
  <version>1.0</version>
  <type>java-source</type>
</dependency>
2. Global in a profile.
<font color=red>Not tested.</font>
{{Internal|Maven_Profile#Download_Sources_for_all_Dependencies|Configure the Profile to Download Sources for all Dependencies}}
3. "dependency" plugin command line:
<font color=red>Not tested.</font>
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
4. "dependency" plugin configuration:
<font color=red>Not tested.</font>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>${maven-dependency-plugin.version}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>sources</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Latest revision as of 22:23, 9 January 2018

Internal

Options

1. Explicit in the <dependencies> section of the POM.

Not tested.

Explicitly specify the "java-source" artifact type along with the default type dependency:

<dependency>
  <groupId>io.example</groupId>
  <artifactId>blue</artifactId>
  <version>1.0</version>
</dependency>
<dependency>
  <groupId>io.example</groupId>
  <artifactId>blue</artifactId>
  <version>1.0</version>
  <type>java-source</type>
</dependency>

2. Global in a profile.

Not tested.

Configure the Profile to Download Sources for all Dependencies

3. "dependency" plugin command line:

Not tested.

mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc

4. "dependency" plugin configuration:

Not tested.

<build>
   <plugins>
       <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-dependency-plugin</artifactId>
           <version>${maven-dependency-plugin.version}</version>
           <executions>
               <execution>
                   <goals>
                       <goal>sources</goal>
                   </goals>
               </execution>
           </executions>
       </plugin>
   </plugins>
</build>