[英]Javadoc task in Ant build fails
I'm receiving an error message from Ant when I try to run the Javadoc ant task. 尝试运行Javadoc ant任务时,我收到来自Ant的错误消息。
"BUILD FAILED /data/data/com.termux/files/home/LearnJava/Observer/build.xml:39: No source files, no packages and no modules have been specified." “构建失败/data/data/com.termux/files/home/LearnJava/Observer/build.xml:39:没有指定源文件,没有包且没有模块。”
The build files reside at: 构建文件位于:
https://github.com/Fernal73/LearnJava/blob/master/Observer/build.properties https://github.com/Fernal73/LearnJava/blob/master/Observer/build.properties
version=1.0.0
main.class=com.javacodegeeks.patterns.observerpattern.TestObserver
main.class1=com.javacodegeeks.patterns.observerpattern.Test
cs.properties=../checkstyle.properties
gformat.properties=../gformat.properties
ant.build.javac.source=1.7
ant.build.javac.target=1.7
packages=com.javacodegeeks.patterns.observerpatern.*
and https://github.com/Fernal73/LearnJava/blob/master/Observer/build.xml 和https://github.com/Fernal73/LearnJava/blob/master/Observer/build.xml
<?xml version="1.0"?>
<project name="Observer" default="main"
basedir=".">
<property file = "build.properties"/>
<property file = "${cs.properties}"/>
<property file = "${gformat.properties}"/>
<!-- Sets variables which can later be used. -->
<!-- The value of a property is accessed via ${} -->
<property name="src.dir" location="." />
<property name="build.dir" location="." />
<property name="dist.dir" location="dist" />
<property name="docs.dir" location="docs" />
<taskdef resource="${cs.taskdef.resource}"
classpath="../${cs.jar}"/>
<!-- Deletes the existing build, docs and dist directory-->
<target name="clean">
<delete>
<fileset dir="." includes="**/*.class"/>
</delete>
<delete dir="${docs.dir}" />
<delete dir="${dist.dir}" />
</target>
<!-- Creates the build, docs and dist directory-->
<target name="makedir">
<mkdir dir="${docs.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<!-- Compiles the java code (including the usage of library for JUnit -->
<target name="compile" depends="clean, makedir,gformat,checkstyle">
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${build.dir}">
<compilerarg value="-Xlint:-options"/>
</javac>
</target>
<!-- Creates Javadoc -->
<target name="docs" depends="compile">
<javadoc packagenames="${packages}" additionalparam="-Xdoclint:none"
sourcepath="${src.dir}"
destdir="${docs.dir}">
<!-- Define which files / directory should get included, we include all -->
<fileset dir="${src.dir}">
<include name="*.java" />
</fileset>
</javadoc>
</target>
<target name="manifest">
<tstamp/>
<manifest file="manifest.mf">
<attribute name="Built-By" value="${user.name}"/>
<section name="common">
<attribute name="Specification-Title" value="${ant.project.name}"/>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor" value=""/>
<attribute name="Implementation-Title" value=""/>
<attribute name="Implementation-Version" value="${build} ${TODAY}"/>
<attribute name="Implementation-Vendor" value=""/>
</section>
<attribute name="Main-Class" value="${main.class}" />
</manifest>
</target>
<!--Creates the deployable jar file -->
<target name="jar" depends="compile,manifest">
<jar destfile="${dist.dir}\${ant.project.name}.jar" basedir="${build.dir}" includes="**/*.class"
manifest="manifest.mf">
</jar>
</target>
<target name="run" >
<description>Run target</description>
<java classname="${main.class}">
<classpath>
<pathelement location="${dist.dir}\${ant.project.name}.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<target name="gformat">
<exec executable="find" dir="${basedir}"
failonerror="true" outputproperty="sources">
<arg line=" . -type f -name '*.java'"/>
</exec>
<echo message="About to format ...: ${sources}"/>
<java classname="${gformat.main.class}">
<arg line=" -i ${sources}"/>
<classpath>
<pathelement location="../${gformat.jar}"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<target name="checkstyle">
<first id="checkstylefile">
<fileset dir=".." includes="${cs.config}"/>
</first>
<checkstyle config="${toString:checkstylefile}"
classpath="../${cs.jar}"
failOnViolation="false" properties="${cs.properties}">
<fileset dir="${src.dir}" includes="**/*.java"/>
<formatter type="plain"/>
<formatter type="plain" toFile="${cs.output}"/>
</checkstyle>
</target>
<target name="main" depends="compile, jar, docs">
<description>Main target</description>
</target>
</project>
respectively. 分别。
My other projects on the repository have similar configurations. 我在存储库上的其他项目具有类似的配置。
They work as expected. 他们按预期工作。
Am I missing something obvious? 我是否缺少明显的东西?
I did miss something obvious. 我确实错过了一些明显的事情。 An extra 't' in the property packages.
属性包中有一个额外的“ t”。 Evidently, I'm going to need two sets of eyes for this or a fresh set, a few hours later!
显然,几个小时后,我将需要两眼或另一双眼睛!
NOW, how do I close this? 现在,我该如何关闭?
I think the problem is in following part: 我认为问题出在以下部分:
<fileset dir="${src.dir}">
<include name="*.java" />
</fileset>
In Ant " *.java
" means all files with names matching *.java. 在Ant中,“
*.java
”表示名称与* .java匹配的所有文件。 This does not search in subdirectories. 这不会在子目录中搜索。 To include all subdirectories you must specify:
要包括所有子目录,您必须指定:
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
But since you already specified the sourcePath
attribute I'm wondering if you can't just remove the fileset element as ant will add **/*.java by default. 但是由于您已经指定了
sourcePath
属性,所以我想知道是否不能仅将文件集元素删除为ant,所以默认情况下会添加** / *。java。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.