不能通过maven-plugins既不生成javadoc也不生成源代码?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了不能通过maven-plugins既不生成javadoc也不生成源代码?相关的知识,希望对你有一定的参考价值。
我想从javadoc
IDE中的代码生成Intellij idea
。
我一步一步走This link。但我没有得到适当的结果。
但在做mvn package
之后,目标文件夹下没有attach-source-javadoc-1.0-SNAPSHOT-javadoc.jar
和attach-source-javadoc-1.0-SNAPSHOT-sources.jar
文件。
这是整个pom文件:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<packaging>war</packaging>
<groupId>gdg</groupId>
<artifactId>dfgdfg</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
...........
</properties>
<dependencies>
...............
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
答案
您已将插件添加到未执行的<pluginManagement
>中。
通过maven-plugins生成javadoc
和source code
你必须把它放在<plugins>
direct内:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</build>
以上是关于不能通过maven-plugins既不生成javadoc也不生成源代码?的主要内容,如果未能解决你的问题,请参考以下文章
[java 2020-04-24] springboot生成的jar包没有主类和依赖jar包