当前位置: 首页 > 知识库问答 >
问题:

Maven javadoc插件-包不存在

魏浩广
2023-03-14

我对maven javadoc插件有点问题。实际上,我试图创建一个javadoc,它只包含我的两个java类。但是当尝试构建时,我总是会得到一个错误列表,例如“包不存在”错误,但这个包是我在Eclipse中自己创建的包。

仅供参考:我使用Java8,Eclipse Mars,m2eclipse。我使用m2eclipse的默认“Maven install”命令构建。

这是我的pom。xml文件

<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>

maven输出了这个(我知道,您可以忽略第一个警告;)

[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

我的代码是开源的,你可以在我的BitBucket页面上找到它

我希望你能帮助我。

共有1个答案

孔宇
2023-03-14

试试这个:

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

Sourcepath必须指向源的根文件夹,它们不得包含包信息。源文件包含必须包含包信息。

 类似资料:
  • 问题内容: 我正在使用NetBeans 7.0.1和JDK 1.6 Update 24,并且在导入软件包以编码密码哈希值时使用: 但是,在编译时,出现以下错误: 我已经阅读了关于同一问题的其他几个问题,但是所有问题都与JDK无关,而这些软件包是()。Code Assists在类型上起作用,展开jar会显示实际上也存在源代码和二进制文件。 我曾尝试清理项目,重建项目,将源文件复制到全新的Enterp

  • 在我的服务中,我想使用类来创建一个JSON对象。为此,我导入了包并保存了它,但当我运行该项目时,会出现以下错误: 错误:包org.codehaus.jettison.json不存在 [javac]导入org.codehaus.jettison.json.JSONException;* 这是我的密码

  • 这不是这个问题的重复。我在将外部依赖项包含到Javadoc中时遇到了问题,这不是问题所在。 我正在尝试将我的API部署到Maven Central。除了Maven Javadoc插件外,一切都很顺利。我的API有两个依赖项(Spigot API-org.spigotmc:Spigot API:1.19-R0.1-SNAPSHOT和JetBrains注释-org.JetBrains:Annotati

  • 问题内容: 是否有只查询记录的查询,如果不存在,则插入?我不想重复更新或替换。寻找一个查询解决方案,寻找其他答案,但不是我真正想要的。 表: 伪查询: 问题答案: 使用-与INSERT完全相同,不同之处在于,如果表中的旧行与PRIMARY KEY或UNIQUE索引的新行具有相同的值,则在插入新行之前会删除该旧行。 http://dev.mysql.com/doc/refman/5.0/en/rep

  • 我有一个pom.xml,大致如下所示: 当我运行单元测试时,然后在我的笔记本电脑上本地调用,一切都很好,只有。我的覆盖率是86%。然而,当我让Jenkins使用相同的命令运行单元测试,然后在我的Jenkinsfile中调用时,我最终得到了附加到构建的报告中的所有代码,因此我的覆盖率最终为2%,因为我没有为一些第三方库编写测试。 我该如何解决这个问题?

  • 当我们开发完插件的功能后需要打包插件时,我们需要进行以下的几个操作。 打包压缩 首先确保插件的目录结构有按照目录结构章节进行规范设计,且所有插件功能均已完成开发和测试。 命令行一键打包 我们可以在命令行一键打包插件,首先闭包工作目录定位到think文件所在目录,如下 cd /var/www/yoursite/ 然后使用 //mydemo为你的插件目录名称 php think addon -a my