简体   繁体   中英

Not able to create Javadoc using Ant

I am trying to build my project using Ant. While creating javadocs, I am getting one error as shown below :

If error is not clearly visible in below image refer this :

[javadoc] javadoc: error - Illegal package name: "E:\junoWrkspace\StrutsHelloWorld\src\com\igate\resources\ApplicationResources.properties"

错误截图

Script which I am using in build.xml for creating javadocs is as follows :

<target name="docs" depends="compile">
    <javadoc packagenames="src" sourcepath="${src.dir}" destdir="${docs.dir}">
        <fileset dir="${src.dir}">
            <include name="**" />
        </fileset>
    </javadoc>
</target>

I had a similar problem and exluding non .java files (like the .properties file) did the trick for me.

<javadoc packagenames="src" sourcepath="${src.dir}" destdir="${docs.dir}">
  <fileset dir="${src.dir}">
      <include name="**/*.java" />
  </fileset>
</javadoc>

Try replacing

<javadoc packagenames="src" sourcepath="${src.dir}" destdir="${docs.dir}">
    <fileset dir="${src.dir}">
        <include name="**" />
    </fileset>
</javadoc>

with just

<javadoc packagenames="src" sourcepath="${src.dir}" destdir="${docs.dir}"/>

Please read the error message! (and @ReOffender answer)

[javadoc] javadoc: error - Illegal package name: "E:\junoWrkspace\StrutsHelloWorld\src\com\igate\resources\ApplicationResources.properties"

javadoc try to generate docs from .properties files that's why javadoc doesn't find "package directive", You MUST ask your target to only generate javadoc from .java file and anything else

So @ReOffender is right:

Change your <include name="**" /> with <include name="**/*.java" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM