`

maven部署的时候同时部署source和javadoc

阅读更多

        今天用maven遇到两小个问题

    1. 上传失败,根据提示才发现是需要填写distributionManagement的repository和snapshotRepository。

代码如下:

       

<distributionManagement>
		<repository>
			<id>xxx_local</id>
			<name>XXXX Local Repository</name>
			<url>http://maven.scm.xxx.com:8081/nexus/content/repositories/XXXX_Local</url>
		</repository>
		<snapshotRepository>
			<id>xxx_local_snapshot</id>
			<name>XXX Local Snapshot Repository</name>
			<url>http://maven.scm.xxx.com:8081/nexus/content/repositories/XXX_Local_Snapshots</url>
		</snapshotRepository>

	</distributionManagement>

 

        2.  向maven私服上传jar的时候没有上传source和javadoc,后来发现,只要添加相关的plugin就可以了,特此记录一下。

       

<plugin>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<phase>deploy</phase>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-javadoc-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<phase>deploy</phase>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<!-- explicitly define maven-deploy-plugin after other to force exec 
					order -->
				<artifactId>maven-deploy-plugin</artifactId>
				<executions>
					<execution>
						<id>deploy</id>
						<phase>deploy</phase>
						<goals>
							<goal>deploy</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

        

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics