[Solved] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar (attach-javadoc) on project postman-web: MavenReportException: Error while creating archive: Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set. -> [Help 1]



Problem:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar (attach-javadoc) on project postman-web: MavenReportException: Error while creating archive: Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set. -> [Help 1]


Solutions: 

Current Java Doc Plugin:

<plugin>    <!-- JavaDoc Plugin to generate a JAR containing documentation from the project. -->    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-javadoc-plugin</artifactId>    <version>2.8.1</version>    <executions>     <execution>      <id>attach-javadoc</id>      <goals>       <goal>jar</goal>      </goals>     </execution>    </executions></plugin>

Excepted Java Doc Plugin: Add configuration in java doc plugin

    <configuration>          <javadocExecutable>${java.home}/../bin/javadoc</javadocExecutable>    </configuration>

Final 

<plugin>    <!-- JavaDoc Plugin to generate a JAR containing documentation from the project. -->    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-javadoc-plugin</artifactId>    <version>2.8.1</version>    <configuration>          <javadocExecutable>${java.home}/../bin/javadoc</javadocExecutable>        </configuration>    <executions>     <execution>      <id>attach-javadoc</id>      <goals>       <goal>jar</goal>      </goals>     </execution>    </executions>   </plugin>