Maven--部署构件至 Nexus

日常开发生成的快照版本构件可以直接部署到 Nexus 中策略为 Snapshot 的宿主仓库中,项目正式发布的构件则应该部署到 Nexus 中策略为 Release 的宿主仓库中。

 

 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 2     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
 3                       http://maven.apache.org/xsd/maven-4.0.0.xsd">
 4 
 5     <modelVersion>4.0.0</modelVersion>
 6     <groupId>org.wzh.maven</groupId>
 7     <artifactId>hello-world</artifactId>
 8     <version>1.0-SNAPSHOT</version>
 9     <name>Maven Hello World Project</name>
10 
11     <build>
12         <plugins>
13             <!-- shade插件打包成jar包 -->
14             <plugin>
15                 <groupId>org.apache.maven.plugins</groupId>
16                 <artifactId>maven-shade-plugin</artifactId>
17                 <version>2.3</version>
18                 <executions>
19                     <execution>
20                         <phase>package</phase>
21                         <goals>
22                             <goal>shade</goal>
23                         </goals>
24                         <configuration>
25                             <transformers>
26                                 <transformer
27                                     implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
28                                     <mainClass>org.wzh.maven.HelloWorld</mainClass>
29                                 </transformer>
30                             </transformers>
31                         </configuration>
32                     </execution>
33                 </executions>
34             </plugin>
35         </plugins>
36     </build>
37 
38     <dependencies>
39         <dependency>
40             <groupId>junit</groupId>
41             <artifactId>junit</artifactId>
42             <version>4.7</version>
43             <scope>test</scope>
44         </dependency>
45         <dependency>
46             <groupId>commons-codec</groupId>
47             <artifactId>commons-codec</artifactId>
48             <version>1.9</version>
49         </dependency>
50     </dependencies>
51 
52     <distributionManagement>
53         <repository>
54             <id>nexus-releases</id>
55             <url>http://10.70.8.36:8081/nexus/content/repositories/releases/</url>
56         </repository>
57         <snapshotRepository>
58             <id>nexus-snapshots</id>
59             <url>http://10.70.8.36:8081/nexus/content/repositories/snapshots/</url>
60         </snapshotRepository>
61     </distributionManagement>
62 
63 
64 </project>

 

posted @ 2017-07-27 14:15  MicroCat  阅读(211)  评论(0编辑  收藏  举报