Maven, javadoc : No source files for package

十年热恋 提交于 2019-12-02 04:55:45

问题


I'm writing a maven package with directory structure

frtex
   pom.xml
frtex/src/main/java/some-files.java
frtex/src/main/java/utils/some-other-files.java

Making mvn test works fine.

My problem is mvn javadoc:javadoc that produces the right documentation for the files contained in frtex/src/main/java but issuing

[WARNING] javadoc: warning - No source files for package utils

Here is the relevant(?) part of my pom.xml :

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.10.4</version>
    <configuration>
        <groups>
            <group>
                <title>TI</title>
                <packages>frtex.*</packages>
            </group>
        </groups>

        <doclet>ch.raffael.doclets.pegdown.PegdownDoclet</doclet>
        <docletArtifact>
            <groupId>ch.raffael.pegdown-doclet</groupId>
            <artifactId>pegdown-doclet</artifactId>
            <version>1.1</version>
        </docletArtifact>
        <useStandardDocletOptions>true</useStandardDocletOptions>
    </configuration>
</plugin>

in project/build/plugins

What should I do to make maven/javadoc found the files in src/main/java/utils ?


回答1:


The problem is not in your maven configuration.

You need to include a package-info.java for the utils package.

It is a file located at src/main/java/utils/package-info.java that will contain the javadoc for the package, in contrast to the javadoc for a class.

For more information about package-level javadocs, you can read the documentation.




回答2:


This is a late response, but I just ran into the same issue.

The solution is you need to add the following to your plugin inside the configuration section

<configuration>
   <sourcepath>src/main/java</sourcepath>
   ...
</configuration>


来源:https://stackoverflow.com/questions/37958104/maven-javadoc-no-source-files-for-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!