Maven javadoc plugin - il pacchetto non esiste


Ho un piccolo problema con il plugin maven javadoc. In realtà cerco di creare un javadoc, che contiene solo due delle mie classi java. Ma quando provo a costruire, ottengo sempre un elenco di errori, ad esempio un errore 'package does not exist', ma questo pacchetto è un pacchetto, che ho creato io stesso in Eclipse.

Solo per informazioni: io uso Java 8, Eclipse Mars, m2eclipse. Costruisco con il comando predefinito "Maven install" di m2eclipse.

Ecco il mio pom.XML file

<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>
  <groupId>de.sumafu</groupId>
  <artifactId>ChestBackpack</artifactId>
  <version>1.1.0</version>
  <repositories>
    <repository>
        <id>spigot-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
    </repository>
  </repositories>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
      <resource>
            <directory>resources</directory>
            <filtering>false</filtering>
        </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
          <appendAssemblyId>false</appendAssemblyId>
          <archive>
            <manifest>
              <mainClass>org.sample.App</mainClass>
            </manifest>
          </archive>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>attached</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <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>
          <configuration>
            <sourceFileIncludes>
              <include>DataHandler.java</include>
              <include>ChestBackpackAPI.java</include>
            </sourceFileIncludes>
            <sourcepath>${basedir}/src/de/sumafu/ChestBackpack/Tools/;${basedir}/src/de/sumafu/ChestBackpack/Data/;${basedir}/src/de/sumafu/ChestBackpack/main/</sourcepath>
          </configuration>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20150729</version>
    </dependency>
    <dependency>
        <groupId>Spigot</groupId>
        <artifactId>org.spigotmc</artifactId>
        <version>1.8.8</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/spigot-1.8.8.jar</systemPath>
    </dependency>
  </dependencies>
</project>

E il maven emette questo (puoi ignorare il primo avviso, lo so;))

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for de.sumafu:ChestBackpack:jar:1.1.0
[WARNING] 'dependencies.dependency.systemPath' for Spigot:org.spigotmc:jar should not point at files within the project directory, ${project.basedir}/spigot-1.8.8.jar will be unresolvable by dependent projects @ line 101, column 18
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ line 57, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 69, column 11
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building ChestBackpack 1.1.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ChestBackpack ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ ChestBackpack ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ChestBackpack ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ ChestBackpack ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ ChestBackpack ---
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ ChestBackpack ---
[INFO] Building jar: /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/ChestBackpack-1.1.0.jar
[INFO] 
[INFO] --- maven-assembly-plugin:2.2-beta-5:attached (default) @ ChestBackpack ---
[INFO] META-INF/ already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] org/ already added, skipping
[INFO] META-INF/maven/ already added, skipping
[INFO] META-INF/ already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] org/ already added, skipping
[INFO] org/openrdf/ already added, skipping
[INFO] META-INF/maven/ already added, skipping
[INFO] META-INF/maven/org.openrdf.sesame/ already added, skipping
[INFO] META-INF/ already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] org/ already added, skipping
[INFO] org/openrdf/ already added, skipping
[INFO] META-INF/maven/ already added, skipping
[INFO] META-INF/maven/org.openrdf.sesame/ already added, skipping
[INFO] META-INF/ already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] org/ already added, skipping
[INFO] META-INF/maven/ already added, skipping
[INFO] Building jar: /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/ChestBackpack-1.1.0.jar
[INFO] META-INF/ already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] org/ already added, skipping
[INFO] META-INF/maven/ already added, skipping
[INFO] META-INF/ already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] org/ already added, skipping
[INFO] org/openrdf/ already added, skipping
[INFO] META-INF/maven/ already added, skipping
[INFO] META-INF/maven/org.openrdf.sesame/ already added, skipping
[INFO] META-INF/ already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] org/ already added, skipping
[INFO] org/openrdf/ already added, skipping
[INFO] META-INF/maven/ already added, skipping
[INFO] META-INF/maven/org.openrdf.sesame/ already added, skipping
[INFO] META-INF/ already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] org/ already added, skipping
[INFO] META-INF/maven/ already added, skipping
[WARNING] Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing.
Instead of attaching the assembly file: /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/ChestBackpack-1.1.0.jar, it will become the file for main project artifact.
NOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!
[WARNING] Replacing pre-existing project main-artifact file: /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/ChestBackpack-1.1.0.jar
with assembly file: /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/ChestBackpack-1.1.0.jar
[INFO] 
[INFO] >>> maven-source-plugin:2.4:jar (attach-sources) > generate-sources @ ChestBackpack >>>
[INFO] 
[INFO] <<< maven-source-plugin:2.4:jar (attach-sources) < generate-sources @ ChestBackpack <<<
[INFO] 
[INFO] --- maven-source-plugin:2.4:jar (attach-sources) @ ChestBackpack ---
[INFO] Building jar: /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/ChestBackpack-1.1.0-sources.jar
[INFO] 
[INFO] --- maven-javadoc-plugin:2.10.3:jar (attach-javadocs) @ ChestBackpack ---
[WARNING] Source files encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] 
Loading source file /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/Data/DataHandler.java...
Loading source file /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/main/ChestBackpackAPI.java...
Constructing Javadoc information...
Standard Doclet version 1.8.0_20
Building tree for all the packages and classes...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/Data/DataHandler.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/main/ChestBackpackAPI.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/overview-frame.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/Data/package-frame.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/Data/package-summary.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/Data/package-tree.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/main/package-frame.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/main/package-summary.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/main/package-tree.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/constant-values.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/Data/class-use/DataHandler.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/main/class-use/ChestBackpackAPI.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/Data/package-use.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/de/sumafu/ChestBackpack/main/package-use.html...
Building index for all the packages and classes...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/overview-tree.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/index-all.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/deprecated-list.html...
Building index for all classes...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/allclasses-frame.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/allclasses-noframe.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/index.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/overview-summary.html...
Generating /Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs/help-doc.html...
2 errors
13 warnings
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.084 s
[INFO] Finished at: 2015-11-23T20:45:36+01:00
[INFO] Final Memory: 20M/314M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.3:jar (attach-javadocs) on project ChestBackpack: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/Data/DataHandler.java:13: error: package de.sumafu.ChestBackpack.Tools does not exist
[ERROR] import de.sumafu.ChestBackpack.Tools.InventoryStringDeSerializer;
[ERROR] ^
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/Data/DataHandler.java:14: error: cannot find symbol
[ERROR] import de.sumafu.ChestBackpack.main.ChestBackpack;
[ERROR] ^
[ERROR] symbol:   class ChestBackpack
[ERROR] location: package de.sumafu.ChestBackpack.main
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/Data/DataHandler.java:23: error: cannot find symbol
[ERROR] public DataHandler(ChestBackpack plugin){
[ERROR] ^
[ERROR] symbol:   class ChestBackpack
[ERROR] location: class DataHandler
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/Data/DataHandler.java:46: error: cannot find symbol
[ERROR] private ChestBackpack plugin;
[ERROR] ^
[ERROR] symbol:   class ChestBackpack
[ERROR] location: class DataHandler
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/Data/DataHandler.java:50: error: cannot find symbol
[ERROR] private DatabaseConnector connector = null;
[ERROR] ^
[ERROR] symbol:   class DatabaseConnector
[ERROR] location: class DataHandler
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/Data/DataHandler.java:51: error: cannot find symbol
[ERROR] private FlatfileHandler filehandler = null;
[ERROR] ^
[ERROR] symbol:   class FlatfileHandler
[ERROR] location: class DataHandler
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/main/ChestBackpackAPI.java:17: error: package de.sumafu.ChestBackpack.Tools does not exist
[ERROR] import de.sumafu.ChestBackpack.Tools.InventoryStringDeSerializer;
[ERROR] ^
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/main/ChestBackpackAPI.java:27: error: cannot find symbol
[ERROR] public ChestBackpackAPI(ChestBackpack plugin){
[ERROR] ^
[ERROR] symbol:   class ChestBackpack
[ERROR] location: class ChestBackpackAPI
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/main/ChestBackpackAPI.java:31: error: cannot find symbol
[ERROR] private ChestBackpack plugin = null;
[ERROR] ^
[ERROR] symbol:   class ChestBackpack
[ERROR] location: class ChestBackpackAPI
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/main/ChestBackpackAPI.java:51: error: cannot find symbol
[ERROR] public Inventory getInventory(UUID uuid) throws CannotLoadBackpackException{
[ERROR] ^
[ERROR] symbol:   class CannotLoadBackpackException
[ERROR] location: class ChestBackpackAPI
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/main/ChestBackpackAPI.java:95: error: cannot find symbol
[ERROR] public boolean openBackpack(UUID uuid) throws CannotLoadBackpackException{
[ERROR] ^
[ERROR] symbol:   class CannotLoadBackpackException
[ERROR] location: class ChestBackpackAPI
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/main/ChestBackpackAPI.java:151: error: cannot find symbol
[ERROR] public ItemStack addItemStack(UUID uuid, ItemStack itemstack) throws CannotLoadBackpackException{
[ERROR] ^
[ERROR] symbol:   class CannotLoadBackpackException
[ERROR] location: class ChestBackpackAPI
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/main/ChestBackpackAPI.java:193: error: cannot find symbol
[ERROR] public boolean containsItemStack(UUID uuid, ItemStack itemstack) throws CannotLoadBackpackException{
[ERROR] ^
[ERROR] symbol:   class CannotLoadBackpackException
[ERROR] location: class ChestBackpackAPI
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/Data/DataHandler.java:80: error: reference not found
[ERROR] * @param invString Backpack as serialized String, see {@link InventoryStringDeSerializer}
[ERROR] ^
[ERROR] /Users/user/Entwicklung/Bukkit/java/ChestBackpack/src/de/sumafu/ChestBackpack/main/ChestBackpackAPI.java:49: error: reference not found
[ERROR] * @throws CannotLoadBackpackException Throw if backpack cannot be loaded
[ERROR] ^
[ERROR] 
[ERROR] Command line was: /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/../bin/javadoc @options @argfile
[ERROR] 
[ERROR] Refer to the generated Javadoc files in '/Users/user/Entwicklung/Bukkit/java/ChestBackpack/target/apidocs' dir.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Il mio codice è open source e puoi trovarlo sulla mia pagina BitBucket

Spero che tu possa aiutarmi.

Author: Sumafu, 2015-11-23

1 answers

Prova questo:

<configuration>
  <sourceFileIncludes>
    <include>**/DataHandler.java</include>
    <include>**/ChestBackpackAPI.java</include>
  </sourceFileIncludes>
</configuration>

Sourcepaths deve puntare alla cartella principale dei sorgenti, non devono includere informazioni sul pacchetto. Il sourceFileIncludes deve contenere informazioni sul pacchetto.

 2
Author: Robert Scholte, 2015-11-23 20:27:31