java - apache ant - No source files and no packages have been specified -
i tried learned apache ant tutorial apache ant - tutorial
but after created step step build file , run throws:
compile: [javac] /home/nazar_art/workspace/de.vogella.build.ant.first/src/test/build.xml:27: warning: 'includeantruntime' not set, defaulting build.sysclasspath=last; set false repeatable builds jar: [jar] building manifest-only jar: /home/nazar_art/workspace/de.vogella.build.ant.first/src/test/dist/de.vogella.build.test.ant.jar docs: build failed /home/nazar_art/workspace/de.vogella.build.ant.first/src/test/build.xml:34: no source files , no packages have been specified. i can't understand why happened? use ubuntu 12.04 os, , eclipse indigo.
build.xml:
<?xml version="1.0"?> <project name="ant-test" default="main" basedir="."> <!-- sets variables can later used. --> <!-- value of property accessed via ${} --> <property name="src.dir" location="src" /> <property name="build.dir" location="bin" /> <property name="dist.dir" location="dist" /> <property name="docs.dir" location="docs" /> <!-- deletes existing build, docs , dist directory--> <target name="clean"> <delete dir="${build.dir}" /> <delete dir="${docs.dir}" /> <delete dir="${dist.dir}" /> </target> <!-- creates build, docs , dist directory--> <target name="makedir"> <mkdir dir="${build.dir}" /> <mkdir dir="${docs.dir}" /> <mkdir dir="${dist.dir}" /> </target> <!-- compiles java code (including usage of library junit --> <target name="compile" depends="clean, makedir"> <javac srcdir="${src.dir}" destdir="${build.dir}"> </javac> </target> <!-- creates javadoc --> <target name="docs" depends="compile"> <javadoc packagenames="src" sourcepath="${src.dir}" destdir="${docs.dir}"> <!-- define files / directory should included, include --> <fileset dir="${src.dir}"> <include name="**" /> </fileset> </javadoc> </target> <!--creates deployable jar file --> <target name="jar" depends="compile"> <jar destfile="${dist.dir}\de.vogella.build.test.ant.jar" basedir="${build.dir}"> <manifest> <attribute name="main-class" value="test.main" /> </manifest> </jar> </target> <target name="main" depends="compile, jar, docs"> <description>main target</description> </target> </project> code part:
package math; public class mymath { public int multi(int number1, int number2) { return number1 * number2; } } package test; import math.mymath; public class main { public static void main(string[] args) { mymath math = new mymath(); system.out.println("result is: " + math.multi(5, 10)); } } - how solve trouble?
in ant build.xml <docs> target trying generate documentation "src" package. try correct package name "math" in <javadoc packagenames="src" sourcepath="..."> packagenames="math,test". can read ant documentation has examples of javadoc task usage.
Comments
Post a Comment