Probleem met Antlib.xml - buildfile fout

Pagina: 1
Acties:

Acties:
  • 0 Henk 'm!

  • dsmeef
  • Registratie: Oktober 2002
  • Laatst online: 08-06-2024
Als ik een java project wil bouwen met een ant build file gaat die fout. De eerste fout die me opvalt is dat de project.build.dir niet gemaakt wordt. ( Deze staat in run.properties en wordt volgens de output wel geladen.) Het lijkt er op dat org/apache/tools/ant/antlib.xml. niet gevonden en dat is raar want die is, neem ik aan een standaard onderdeel van ant.

Ik heb dit overigens geprobeerd met zowel ant 1.6 als 1.7 bij beide krijg ik het zelfde resultaat


Hier onderstaan de build file en de output file.

Build file


code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?xml version="1.0" ?>
<project default="run" basedir=".">

<property file="run.properties"/>

<path id="compilation-classpath">
  <fileset dir="C:\Program
Files\eclipse\plugins\org.apache.ant_1.7.0.v200706080842\lib">
    <include name="*.jar"/>
  </fileset>
  <fileset dir="${project.dir.lib}">
    <include name="**/*.jar"/>
  </fileset>
</path>

<target name="init" description="Main target">
  <tstamp/>
  <property name="archive" value="${project.name}-${DSTAMP}"/>
</target>

<target name="compile" depends="init" description="Compile to build directory">
  <mkdir dir="${project.build.dir}"/>
  <javac srcdir="${project.dir.src}"
       destdir="${project.build.dir}">
       <classpath refid="compilation-classpath"/>
  </javac>
  <copy todir="${project.build.dir}">
    <fileset dir="${project.dir.src}" excludes="**/*.java"/>
  </copy>

<!--
  <copy todir="${project.build.dir}" includeemptydirs="false" flatten="true">
    <fileset dir="${project.dir.src}">
    <exclude name="**/*.java"/>
    </fileset>
  </copy>
-->
</target>


<target name="dist" depends="compile" description="Version distribution">
  <delete dir="${project.dir.dist}"/>
  <mkdir dir="${project.dir.dist}"/>

  <jar jarfile="${project.dir.dist}/${archive}.jar"
       basedir="${project.build.dir}"/>

  <copy todir="${project.dir.dist}">
    <fileset dir="${project.dir.lib}">
    <include name="**/*.jar"/>
    </fileset>
  </copy>

<!--
  <copy todir="${project.dir.dist}" includeemptydirs="false" flatten="true">
    <fileset dir="${project.dir.src}">
    <exclude name="**/*.java"/>
    </fileset>
  </copy>
-->

</target>

<target name="run" description="Run distribution version">
  <java classname="com.bigmenlab.apps.mailinglist.Main"
        dir="${project.dir.dist}"
        fork="true">
        <classpath>
          <fileset dir="${project.dir.dist}">
        <include name="**/*.jar"/>
        </fileset>
        </classpath>
    <jvmarg value="-Xms256m"/>
    <jvmarg value="-Xmx512m"/>
  </java>
</target>

<target name="distrun" depends="dist" description="Run distribution version">
  <java classname="com.bigmenlab.apps.mailinglist.Main"
        dir="${project.dir.dist}"
        fork="true">
        <classpath>
          <fileset dir="${project.dir.dist}" includes="**/*.jar"/>
        </classpath>
    <jvmarg value="-Xms256m"/>
    <jvmarg value="-Xmx512m"/>
  </java>
</target>


</project>


Output file


code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Detected Java version: 1.6 in: C:\Program Files\Java\jdk1.6.0_10\jre Detected OS: Windows Vista parsing buildfile C:\Users\Roel\workspace\Mailinglist\run.xml with URI = file:/C:/Users/Roel/workspace/Mailinglist/run.xml
Project base dir set to: C:\Users\Roel\workspace\Mailinglist
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
 [property] Loading C:\Users\Roel\workspace\Mailinglist\run.properties

BUILD FAILED
Target "run" does not exist in the project "null".
    at org.apache.tools.ant.Project.tsort(Project.java:1821)
    at org.apache.tools.ant.Project.topoSort(Project.java:1729)
    at org.apache.tools.ant.Project.topoSort(Project.java:1692)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.Main.runBuild(Main.java:698)
    at org.apache.tools.ant.Main.startAnt(Main.java:199)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 0 seconds


Heeft iemand een idee wat het probleem is met de antlib.xml ? Ik heb er al op geprobeerd te googlen, maar krijg niets helpends gevonden.. ;(