念念不忘
必有回响

Maven学习-常用插件配置

Maven常用插件

properties配置:

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.jdk>1.8</project.build.jdk>
        <mvn.compiler.version>3.3</mvn.compiler.version>
</properties>

maven-compiler-plugin (编译的插件)

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<configuration>
		<source>${project.build.jdk}</source>
		<target>${project.build.jdk}</target>
		<encoding>${project.build.sourceEncoding}</encoding>
  </configuration>
</plugin>

maven-source-plugin (打包源码的插件)

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-source-plugin</artifactId>
	<executions>
		<execution>
			<id>sources</id>
			<goals>
				<goal>jar</goal>
			</goals>
		</execution>
	</executions>
</plugin>

maven-javadoc-plugin (打包文档的插件)

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-javadoc-plugin</artifactId>
	<configuration>
		<encoding>${project.build.sourceEncoding}</encoding>
	</configuration>
	<executions>
		<execution>
			<id>javadocs</id>
			<goals>
				<goal>jar</goal>
			</goals>
		</execution>
	</executions>
</plugin>

最终配置

<build>
	<finalName>data-ui</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>${project.build.jdk}</source>
					<target>${project.build.jdk}</target>
					<encoding>${project.build.sourceEncoding}</encoding>
			  </configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>sources</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<configuration>
					<encoding>${project.build.sourceEncoding}</encoding>
				</configuration>
				<executions>
					<execution>
						<id>javadocs</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
	</plugins>
</build>

 

赞(0) 打赏
未经允许不得转载:码农志 » Maven学习-常用插件配置
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏