maven package source method

  1. In the official documentation of preparations, the above situation is called Artifact Bundles, and the official description is as follows: Artifact Bundles refer to a group of components with the same GAV coordinates (gourpId, artifactId, version). To compile a Bundle, your project's POM file must contain the following elements.

[html] view plain copy <project>
<modelVersion></modelVersion>
<groupId></groupId>
<artifactId></artifactId>
<packaging></packaging>
<name></name>
<version></version>
<description></description>
<url></url>
<licenses></licenses>
<scm></scm>
<url></url>
<connection></connection>
</scm>
</project>

下面是一个最简单是POM.XML的示例 [html] view plain copy <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>
<groupId>com.sonatype.sample</groupId>
<artifactId>sample-project</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>sample-project</name>
<description>A Sample Project for the Nexus Book</description>
<url>http://books.sonatype.com</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<connection>
scm:git:git://github.com/sonatype/sample-project.git
</connection>
<url>http://github.com/sonatype/sample-project.git</url>
<developerConnection>
scm:git:git://github.com/sonatype-sample-project.git
</developerConnection>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

Note that the link address in <scm></scm> in the above example does not need to be your own private address, just copy the one I have here and use it. 2. After compiling and modifying pom.xml, you can compile it. Use the following command to compile.

mvn clean javadoc:jar source:jar repository:bundle-create

Reprinted from http://blog.csdn.net/zhu19774279/article/details/49813303

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325201920&siteId=291194637