Reputation: 2735
This is my first java project deploying ant. I have to submit my code soon and do not have time for Hello World sort of thing for Ant. I tried to make a build.xml for my project after doing a bit of google but now i am stuck!
The ant javadoc does not work for me. Below is the error it displays when given the command : ant javadoc -debug
Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor
Adding reference: ant.executor
BUILD FAILED
Target "javadoc" does not exist in the project "Ant-Test".
at org.apache.tools.ant.Project.tsort(Project.java:1912)
at org.apache.tools.ant.Project.topoSort(Project.java:1820)
at org.apache.tools.ant.Project.topoSort(Project.java:1783)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 0 seconds
the package under which i have created all my four classes
package org.acrusys.customers;
and last but not the least below is the directory structure
Directory of C:\Users\Salman\JavaWorkspace\Arcusys\src\org\acrusys\customers
04/11/2012 07:40 PM <DIR> .
04/11/2012 07:40 PM <DIR> ..
04/11/2012 06:20 PM 757 AllCustomers.class
04/11/2012 12:22 PM 520 AllCustomers.java
04/11/2012 07:40 PM <DIR> build
04/11/2012 07:30 PM 1,746 build.xml
04/11/2012 03:09 PM <DIR> classes
04/11/2012 06:20 PM 1,470 Customer.class
04/11/2012 05:27 PM 1,456 Customer.java
04/11/2012 06:20 PM 1,396 CustomerFullAddress.class
04/10/2012 11:55 PM 1,343 CustomerFullAddress.java
04/11/2012 06:20 PM 2,890 CustomerMain.class
04/11/2012 06:19 PM 2,392 CustomerMain.java
04/11/2012 07:40 PM <DIR> dist
04/11/2012 07:40 PM <DIR> docs
04/11/2012 06:55 PM <DIR> src
Here is the Javadoc (i forget to paste it initially)
<target name="docs" depends="compile">
<javadoc packagenames="org.acrusys.customers.*" sourcepath="${src.dir}" destdir="${docs.dir}">
<!-- Define which files / directory should get included, we include all -->
<fileset dir="${src.dir}">
<include name="**" />
</fileset>
</javadoc>
</target>
Upvotes: 1
Views: 2565
Reputation: 627
This code is working for me. I am giving here only target you need to use this target.
<target name="docs" depends="compile">
<javadoc packagenames="src" sourcepath="${src.dir}" destdir="${docs.dir}">
<!-- Define which files / directory should get included, we include all -->
<fileset dir="${src.dir}">
<include name="**" />
</fileset>
</javadoc>
</target>
After running this target you will get all documents into your doc folder.
Upvotes: 1
Reputation: 107090
Are you doing:
$ ant javadoc
or
$ ant docs
You're target name is docs
and not javadoc
. You should be doing the latter.
Upvotes: 1
Reputation: 102
Javadoc is normally associated with documentation that you write into your code in the form of comments, and is automatically extracted out into HTML Files.
Try running: ant jar
The target you specified in your build file is "jar". This will not fix all of your problems, as I can't see your compile target. It also seems like your source code is in the wrong place (It should be located in the src directory, under the correct package structure), and the built .class files are also not ending up in the build directory.
Upvotes: 1