Maven项目框架源代码和文档的查看

方便maven项目的调试和源代码学习,可以通过添加maven插件的方式下载源代码和文件进行查看。

mavan插件节点结构如下:

<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.etc</groupId>
	<artifactId>smbms</artifactId>
	<packaging>war</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>smbms Maven Webapp</name>
	<url>http://maven.apache.org</url>
	<!-- 定义变量 -->
	<properties>
		//属性节点
	</properties>

	<dependencies>
		<dependency>
			//各种依赖
		</dependency>
	</dependencies>
	<build>
		<finalName>项目构建文件名</finalName>
		<plugins>
			<!-- 查看源码 -->
			<plugin>
				//查看源代码插件
			</plugin>
			<!-- 查看javadoc -->
			<plugin>
                                //查看javadoc插件
			</plugin>
		</plugins>
	</build>
</project>

  

使用步骤:

1.添加查看源码插件

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-source-plugin</artifactId>
	<version>3.0.1</version>
	<executions>
		<execution>
			<id>attach-sources</id>
			<phase>verify</phase>
			<goals><goal>jar-no-fork</goal></goals>
		</execution>
	</executions>
</plugin>

  

2.添加查看javadoc插件

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-javadoc-plugin</artifactId>
	<version>3.0.0</version>
	<executions>
			<execution>
				<id>attach-javadocs</id>
				<goals>
					<goal>jar</goal>
				</goals>
			</execution>
	</executions>
</plugin>

  

3.更新源代码和javaDoc以及更新项目(myeclipse2014)

 

 

posted @ 2018-03-25 09:25  rask  阅读(679)  评论(0编辑  收藏  举报