When I run ant test everything is cool, but when Travis runs the same command I get
$ ant test
Buildfile:
/home/travis/build/AwesomeTeamPlayer/event-receiver/build.xml
compile:
[mkdir] Created dir: /home/travis/build/AwesomeTeamPlayer/event-receiver/build
[javac] /home/travis/build/AwesomeTeamPlayer/event-receiver/build.xml:28:
warning: 'includeantruntime' was not set, defaulting to
build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 12 source files to /home/travis/build/AwesomeTeamPlayer/event-receiver/build
[javac] Note: /home/travis/build/AwesomeTeamPlayer/event-receiver/src/EventReceiver/EventsCollection.java
uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
test-compile:
[mkdir] Created dir: /home/travis/build/AwesomeTeamPlayer/event-receiver/build/test
[javac] Compiling 3 source files to /home/travis/build/AwesomeTeamPlayer/event-receiver/build/test
test:
BUILD FAILED
/home/travis/build/AwesomeTeamPlayer/event-receiver/build.xml:42:
Problem: failed to create task or type junit
Cause: the class
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found.
This looks like one of Ant's optional components. Action: Check that the appropriate optional JAR exists in
-/usr/share/ant/lib
-/home/travis/.ant/lib
-a directory added on the command line with the -lib argument
Do not panic, this is a common problem.
The commonest cause is a missing JAR.
This is not a bug; it is a configuration problem
When I changed ant test to ant test -lib ./lib/junit-4.12.jar in .travis.yml file I get the same error message :/
.travis.yml:
language: java
jdk:
- oraclejdk8
services:
- docker
script: ant test -lib ./lib/junit-4.12.jar
build.xml:
<?xml version="1.0" encoding="iso-8859-2"?>
<project name="Project name" basedir="." default="compile">
<property name="src.dir" value="./src"/>
<property name="build.dir" value="./build"/>
<property name="lib.dir" value="./lib"/>
<property name="test.dir" value="./tests"/>
<property name="test.build.dir" value="./build/test"/>
<path id="classpath.compile">
<pathelement location="${lib.dir}/amqp-client-4.0.2.jar"/>
<pathelement location="${lib.dir}/json-20170516.jar"/>
<pathelement location="${lib.dir}/slf4j-api-1.7.25.jar"/>
<pathelement location="${lib.dir}/slf4j-simple-1.7.25.jar"/>
<pathelement location="${build.dir}"/>
</path>
<path id="classpath.test">
<pathelement location="${lib.dir}/mockito-all-1.10.19.jar"/>
<pathelement location="${lib.dir}/junit-4.12.jar"/>
<pathelement location="${lib.dir}/hamcrest-core-1.3.jar"/>
<pathelement location="${build.dir}"/>
</path>
<target name="compile" depends="">
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.dir}" destdir="${build.dir}">
<classpath refid="classpath.compile"/>
</javac>
</target>
<target name="test-compile" depends="compile">
<mkdir dir="${test.build.dir}"/>
<javac srcdir="${test.dir}" destdir="${test.build.dir}" includeantruntime="false">
<classpath refid="classpath.test"/>
<classpath refid="classpath.compile"/>
</javac>
</target>
<target name="test" depends="test-compile">
<junit printsummary="on" haltonfailure="yes" fork="true">
<classpath>
<path refid="classpath.test"/>
<path refid="classpath.compile"/>
<pathelement location="${test.build.dir}"/>
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${test.dir}" includes="**/*Test.java" />
</batchtest>
</junit>
</target>
<target name="test-integration" depends="test-compile">
<junit printsummary="on" haltonfailure="yes" fork="true">
<classpath>
<path refid="classpath.test"/>
<path refid="classpath.compile"/>
<pathelement location="${test.build.dir}"/>
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${test.dir}" includes="integration/**/*Test.java" />
</batchtest>
</junit>
</target>
</project>
In lib dir I have
amqp-client-4.0.2.jar
hamcrest-core-1.3.jar
json-20170516.jar
junit-4.12.jar
mockito-all-1.10.19.jar
slf4j-api-1.7.25.jar
slf4j-simple-1.7.25.jar
I figure out what to do. I added
before_script:
- sudo apt-get install ant-optional
and that fixed my problem ;)
As mentioned on https://docs.travis-ci.com/user/installing-dependencies/:
To install Ubuntu packages that are not included in the standard
precise, trusty, xenial, or bionic distribution, use apt-get in the
before_install step of your .travis.yml.
Which translates to adding the following to your .travis.yml file:
before_install:
- sudo apt-get install ant-optional
Related
I am a beginner in Ant and GWT and I was creating a new Ant project in GWT by following the steps mentioned on this GWT page: webAppCreator under the Creating an Ant project section. I was able to create this project successfully but I got the error build.xml does not exist! in the Command Prompt log. I am unable to fix this problem even after following all the steps mentioned here : ant build.xml file doesn't exist.
Here is my Command Prompt log:
C:\Users\TEST>webAppCreator -junit D:\SELENIUM\junit-4.10.jar -out foo com.example.foo.Foo
Generating from templates: [sample, eclipse, readme, _eclipse-test, _sample-test, ant]
Created directory foo
Created directory foo\src
Created directory foo\src\com\example\foo
Created directory foo\src\com\example\foo\client
Created directory foo\src\com\example\foo\server
Created directory foo\src\com\example\foo\shared
Created directory foo\test
Created directory foo\test\com\example\foo
Created directory foo\war
Created directory foo\war\WEB-INF
Created directory foo\test\com\example\foo\client
Created file foo\src\com\example\foo\Foo.gwt.xml
Created file foo\src\com\example\foo\client\GreetingService.java
Created file foo\src\com\example\foo\client\GreetingServiceAsync.java
Created file foo\src\com\example\foo\client\Foo.java
Created file foo\src\com\example\foo\server\GreetingServiceImpl.java
Created file foo\src\com\example\foo\shared\FieldVerifier.java
Created file foo\war\WEB-INF\web.xml
Created file foo\war\Foo.css
Created file foo\war\Foo.html
Created file foo\war\favicon.ico
Created file foo\.classpath
Created file foo\.project
Created file foo\Foo.launch
Created file foo\README.txt
Created file foo\FooSuite-dev.launch
Created file foo\FooSuite-prod.launch
Created file foo\test\com\example\foo\FooJUnit.gwt.xml
Created file foo\test\com\example\foo\FooSuite.java
Created file foo\test\com\example\foo\client\FooTest.java
Created file foo\build.xml
C:\Users\TEST>ant build
Buildfile: build.xml does not exist!
Build failed
C:\Users\TEST>ant devmode
Buildfile: build.xml does not exist!
Build failed
Here is my build.xml file:
<?xml version="1.0" encoding="utf-8" ?>
<project name="Foo" default="build" basedir=".">
<!-- Arguments to gwtc and devmode targets -->
<property name="gwt.args" value="" />
<!-- Configure path to GWT SDK -->
<property name="gwt.sdk" location="D:/GWT/gwt-2.8.1/gwt-2.8.1" />
<path id="project.class.path">
<pathelement location="war/WEB-INF/classes"/>
<pathelement location="${gwt.sdk}/gwt-user.jar"/>
<pathelement location="${gwt.sdk}/gwt-dev.jar"/>
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar"/>
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar"/>
<fileset dir="war/WEB-INF/lib" includes="**/*.jar"/>
<!-- Add any additional non-server libs (such as JUnit) here -->
</path>
<target name="libs" description="Copy libs to WEB-INF/lib">
<mkdir dir="war/WEB-INF/lib" />
<copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet.jar" />
<copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet-deps.jar" />
<!-- Add any additional server libs that need to be copied -->
</target>
<target name="javac" depends="libs" description="Compile java source to bytecode">
<mkdir dir="war/WEB-INF/classes"/>
<javac srcdir="src" includes="**" encoding="utf-8"
destdir="war/WEB-INF/classes"
source="1.7" target="1.7" nowarn="true"
debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path"/>
</javac>
<copy todir="war/WEB-INF/classes">
<fileset dir="src" excludes="**/*.java"/>
</copy>
</target>
<target name="gwtc" depends="javac" description="GWT compile to JavaScript (production mode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler" maxmemory="512m">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
</classpath>
<arg line="-war"/>
<arg value="war"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}"/>
<arg value="com.example.foo.Foo"/>
</java>
</target>
<target name="devmode" depends="javac" description="Run development mode (pass -Dgwt.args=-nosuperDevMode to fallback to classic DevMode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode" maxmemory="1g">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
<pathelement location="${gwt.sdk}/gwt-codeserver.jar"/>
</classpath>
<arg value="-startupUrl"/>
<arg value="Foo.html"/>
<arg line="-war"/>
<arg value="war"/>
<!-- Additional arguments like -style PRETTY, -logLevel DEBUG or -nosuperDevMode -->
<arg line="${gwt.args}"/>
<arg value="com.example.foo.Foo"/>
<arg value="com.example.foo.Foo"/>
</java>
</target>
<target name="javac.tests" depends="javac" description="Compiles test code">
<javac srcdir="test" includes="**" encoding="utf-8"
source="1.7" target="1.7" nowarn="true"
destdir="war/WEB-INF/classes"
debug="true" debuglevel="lines,vars,source">
<classpath location="D:\SELENIUM\junit-4.10.jar"/>
<classpath refid="project.class.path"/>
</javac>
</target>
<target name="test.dev" depends="javac.tests" description="Run development mode tests">
<mkdir dir="reports/htmlunit.dev" />
<junit fork="yes" printsummary="yes" haltonfailure="yes" maxmemory="256m">
<sysproperty key="gwt.args" value="-devMode -logLevel WARN -war www-test" />
<sysproperty key="java.awt.headless" value="true" />
<classpath>
<pathelement location="src" />
<pathelement location="test" />
<path refid="project.class.path" />
<pathelement location="D:/GWT/gwt-2.8.1/gwt-2.8.1/validation-api-1.0.0.GA.jar" />
<pathelement location="D:/GWT/gwt-2.8.1/gwt-2.8.1/validation-api-1.0.0.GA-sources.jar" />
<pathelement location="D:\SELENIUM\junit-4.10.jar" />
</classpath>
<batchtest todir="reports/htmlunit.dev" >
<fileset dir="test" >
<include name="**/*Suite.java" />
</fileset>
</batchtest>
<formatter type="plain" />
<formatter type="xml" />
</junit>
</target>
<target name="test.prod" depends="javac.tests" description="Run production mode tests">
<mkdir dir="reports/htmlunit.prod" />
<junit fork="yes" printsummary="yes" haltonfailure="yes" maxmemory="256m">
<sysproperty key="gwt.args" value="-logLevel WARN -war www-test" />
<sysproperty key="java.awt.headless" value="true" />
<classpath>
<pathelement location="src" />
<pathelement location="test" />
<path refid="project.class.path" />
<pathelement location="D:/GWT/gwt-2.8.1/gwt-2.8.1/validation-api-1.0.0.GA.jar" />
<pathelement location="D:/GWT/gwt-2.8.1/gwt-2.8.1/validation-api-1.0.0.GA-sources.jar" />
<pathelement location="D:\SELENIUM\junit-4.10.jar" />
</classpath>
<batchtest todir="reports/htmlunit.prod" >
<fileset dir="test" >
<include name="**/*Suite.java" />
</fileset>
</batchtest>
<formatter type="plain" />
<formatter type="xml" />
</junit>
</target>
<target name="test" description="Run development and production mode tests">
<antcall target="test.dev" />
<antcall target="test.prod" />
</target>
<target name="build" depends="gwtc" description="Build this project" />
<target name="war" depends="build" description="Create a war file">
<zip destfile="Foo.war" basedir="war"/>
</target>
<target name="clean" description="Cleans this project">
<delete dir="war/WEB-INF/classes" failonerror="false" />
<delete dir="war/foo" failonerror="false" />
</target>
</project>
Can someone please help me to fix this issue?
It seems your build.xml is created in a foo folder.
See this output:
Created file foo\build.xml
Go to the foo directory and then run ant.
C:\Users\TEST>ant build
Buildfile: build.xml does not exist!
Build failed
It means build file is absent in TEST directory. Checking your logs you have one in the :\Users\TEST\foo. So you should navigate into foo than try command via terminal one more time.
if you are on Mac :
brew install ant;
brew install ivy;
ant ivy-bootstrap ;
then go to top of ant project;
run ant
I have an ant build file for a java project the project tree looks like this :
DataBaseFidling.
|-->src (contains production code source)
|-->tests (contains tests code source)
|-->bin (contains .class)
|-->reports(contains junit xml reports)
|-->build.xml
Whenever I import this project with eclipse using "Java Project From Existing Ant Build File", eclipse does not reconize the tests folder as a source folder.
What to do to fix this?
Here is the ant build file :
The DatabaseFidling Project.
<property name="src.dir" location="./src/" />
<property name="tests.dir" location="./tests/" />
<property name="bin.dir" location="./bin/" />
<property name="lib.dir" location="/home/chedy/workspace/lib"/>
<target name="clean">
<delete verbose="true">
<fileset dir="${bin.dir}"/>
</delete>
</target>
<target name="compile">
<javac srcdir="${src.dir}" destdir="${bin.dir}">
</javac>
<javac srcdir="${tests.dir}" destdir="${bin.dir}">
<classpath>
<pathelement location="${lib.dir}/junit4.jar"/>
<pathelement location="${lib.dir}/mockito-all-1.9.5.jar"/>
<pathelement location="${lib.dir}/SQLScriptRunner.jar"/>
</classpath>
</javac>
</target>
<target name="test" depends="compile">
<junit printsummary="yes" fork="true" >
<formatter type="xml"/>
<classpath>
<pathelement path="${bin.dir}"/>
<pathelement location="${lib.dir}/junit4.jar"/>
<pathelement location="${lib.dir}/mockito-all-1.9.5.jar"/>
<pathelement location="${lib.dir}/SQLScriptRunner.jar"/>
<pathelement location="${lib.dir}/mysql-connector-java-5.1.23-bin.jar" />
</classpath>
<batchtest todir="./report">
<fileset dir="${bin.dir}">
<include name="**/**Test*.*"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="run" depends="compile">
<java classname="com.esprit.is.Main" fork="true">
<classpath>
<pathelement path="${bin.dir}"/>
<pathelement location="${lib.dir}/mysql-connector-java-5.1.23-bin.jar" />
</classpath>
</java>
</target>
</project>
You can manually add the test folder as a source folder. Right click the project, Build Path -> Configure Build Path -> Java Build Path. In the Source tab, click Link Source then browse to your folder.
The compile target had to contain one javac task which compiles both the src and test folders.
Environment: Mac OSX 10.7.5, Eclipse 4.2.1, Apache Ant version 1.8.2
I created a sample Hello World program in Eclipse then exported the project into a build.xml file.
At the prompt i type in:
$ant
Buildfile: /Users/cspam/Documents/workspace/TestHelloWorld/build.xml
build-subprojects:
init:
build-project:
[echo] TestHelloWorld: /Users/cspam/Documents/workspace/TestHelloWorld/build.xml
build:
BUILD SUCCESSFUL
but the build directory that i am looking for is not created. Here is my xml file:
<project basedir="." default="build" name="TestHelloWorld">
<property environment="env"/>
<property name="ECLIPSE_HOME" value="../../eclipse"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="TestHelloWorld.classpath">
<pathelement location="bin"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target name="cleanall" depends="clean"/>
<target name="build" depends="build-subprojects,build-project"/>
<target name="build-subprojects"/>
<target name="build-project" depends="init">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="TestHelloWorld.classpath"/>
</javac>
</target>
<target name="build-refprojects" description="Build all projects which reference this project. Useful to propagate changes."/>
<target name="init-eclipse-compiler" description="copy Eclipse compiler jars to ant lib directory">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target name="build-eclipse-compiler" description="compile project with Eclipse compiler">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>
I am new to using Ant - so this is all new to me. I was told that it should build a "Build" directory but it is not created. I am not sure what I am doing so would appreciate any pointers/help/suggestions.
UPDATE: as #Cliff suggested. here is the output for ant after doing ant -clean
Buildfile: /Users/cspam/Documents/workspace/TestHelloWorld/build.xml
build-subprojects:
init:
[mkdir] Created dir: /Users/cspam/Documents/workspace/TestHelloWorld/bin
build-project:
[echo] TestHelloWorld: /Users/cspam/Documents/workspace/TestHelloWorld/build.xml
[javac] Compiling 2 source files to /Users/cspam/Documents/workspace/TestHelloWorld/bin
build:
BUILD SUCCESSFUL Total time: 0 seconds
looks like the .class files were indeed created after a clean. Right clicking the "build.xml" file from within Eclipse and doing Run As->Ant Build will also do the same successfully.
I am in the process of now pushing this xml file off to Bamboo to see if i can get a clean run. Is this a straight forward process? thanks again for help.
I am trying to write ant script for my project but at javac i am facing this issue:
80: package com.sun.xml.internal.fastinfoset.util does not exist
[javac] import com.sun.xml.internal.fastinfoset.util.StringArray;
[javac] ^
JAVA_HOME is set to jdk1.6
ANT_HOME is set to apache-ant-1.8.4
build file is
<?xml version="1.0" ?>
<project name="project" default="war">
<property name="location" location="D:\Project"></property>
<property name="project-location" location="${location}\project"></property>
<path id="Web App Libraries.libraryclasspath">
<fileset dir="${project-location}/web/WEB-INF/lib"/>
</path>
<path id="EAR Libraries.libraryclasspath"/>
<path id="compile.classpath">
<pathelement location="${project-location}/web/WEB-INF/classes"/>
<path refid="Web App Libraries.libraryclasspath"/>
<path refid="EAR Libraries.libraryclasspath"/>
</path>
<path id="Server Library [JBoss v4.2] (unbound).libraryclasspath"/>
<target name="init" >
<mkdir dir="D:/JBOSSHOME/build/classes"/>
<mkdir dir="D:/JBOSSHOME/dist" />
</target>
<target name="compile" depends="init" >
<javac destdir="D:/JBOSSHOME/build/classes" debug="true" srcdir="${project-location}/src">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="war" depends="compile">
<war destfile="D:/JBOSSHOME/project.war" webxml="${project-location}/web/WEB-INF/web.xml">
<fileset dir="${project-location}/web"/>
<lib dir="${project-location}/web/WEB-INF/lib"/>
<classes dir="D:/JBOSSHOME/build/classes"/>
</war>
</target>
any help or pointer would be much appreciated ty!
com.sun.internal packages are NOT recommended to use , because
they are not guaranteed to be available across environments
support to those classes are also not guaranteed
I try to install leJOS NXJ on my MAC OS X and run it's sample, but after I do what it wants and export NXJ_Home Path file and etc. and install netbeans plugin and create it sample project (Creating your own project using the Netbeans Plugin). I also follow this structure and replace desire classes.jar from intsall leJOS NXJ installation's lib folder.
I export these 4 lines:
My-macbook-pro:~ AR$ export NXJ_HOME=/Users/AR/Documents/Research-kar/JAVA/lejos_nxj
My-macbook-pro:~ AR$ export DYLD_LIBRARY_PATH=$NXJ_HOME/bin
My-macbook-pro:~ AR$ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
My-macbook-pro:~ AR$ export PATH=$PATH:$JAVA_HOME/bin:$NXJ_HOME/binamirrezas-macbook-pro:~ AR$
This is leJOS NXJ sample code:
package org.lejos.example;
import lejos.nxt.*;
/**
* Example leJOS Project with an ant build file
*
*/
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
Button.waitForPress();
}
}
and this is related build.xml file:
<project name="Example" default="uploadandrun">
<description>
org.lejos.example.HelloWorld build file
</description>
<!-- set properties for this build -->
<property environment = "env"/>
<property file="build.properties"/>
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="program" value="Example"/>
<property name="main.class" value="org.lejos.example.HelloWorld"/>
<property name="binary" value="${build}/${program}.nxj" />
<!-- deletes generated files -->
<target name="clean" description="clean up all generated files">
<delete dir="build"/>
</target>
<target name="compile" depends="clean"
description="compile the source " >
<!-- Compile the java code from ${src} to ${build} -->
<mkdir dir="${build}"/>
<javac srcdir="${src}" destdir="${build}">
<bootclasspath>
<pathelement location="${nxj.classes.home}/lib/classes.jar"/>
</bootclasspath>
</javac>
</target>
<target name="link" depends="compile"
description="link the binary " >
<!-- Link the binary and create a signature file -->
<java classname="js.tinyvm.TinyVM">
<arg value="--bootclasspath"/>
<arg path="${nxj.classes.jar}" />
<arg value="--classpath"/>
<arg path="${build}" />
<arg value="--writeorder" />
<arg value="LE" />
<arg value="${main.class}"/>
<arg value="-o"/>
<arg value="${binary}"/>
<arg value="-v"/>
<classpath>
<pathelement location="${nxj.jtools.jar}"/>
<pathelement location="${nxj.commons.jar}"/>
<pathelement location="${nxj.bcel.jar}"/>
</classpath>
</java>
</target>
<target name="upload" depends="link"
description="upload the binary" >
<java classname="lejos.pc.tools.NXJUpload" fork="true">
<jvmarg value="-Djava.library.path=${nxj.library.path}"/>
<jvmarg value="-Dnxj.home=${nxj.home}"/>
<arg value="${binary}"/>
<classpath>
<pathelement location="${nxj.jtools.jar}"/>
<pathelement location="${nxj.pctools.jar}"/>
<pathelement location="${nxj.pccomm.jar}"/>
<pathelement location="${nxj.commons.jar}"/>
<pathelement location="${nxj.bcel.jar}"/>
<pathelement location="${nxj.bluecove.jar}"/>
<pathelement location="${nxj.bluecove-gpl.jar}"/>
</classpath>
</java>
</target>
<target name="uploadandrun" depends="link"
description="upload and run the binary" >
<java classname="lejos.pc.tools.NXJUpload" fork="true">
<jvmarg value="-Djava.library.path=${nxj.library.path}"/>
<jvmarg value="-Dnxj.home=${nxj.home}"/>
<arg value="${binary}"/>
<arg value="-r"/>
<classpath>
<pathelement location="${nxj.jtools.jar}"/>
<pathelement location="${nxj.pctools.jar}"/>
<pathelement location="${nxj.pccomm.jar}"/>
<pathelement location="${nxj.commons.jar}"/>
<pathelement location="${nxj.bcel.jar}"/>
<pathelement location="${nxj.bluecove.jar}"/>
<pathelement location="${nxj.bluecove-gpl.jar}"/>
</classpath>
</java>
</target>
<!-- used only for modifying the Netbeans NXJPlugin -->
<target name="Zip for Netbeans" description="Zip the application to the sample project">
<property name="build.classes.dir" location="/build"/>
<property name="plugin" location="../NXJPlugin/src/nxjplugin/"/>
<zip basedir="." destfile="${plugin}/NXJSampleProject.zip">
<exclude name="**/build/"/>
<exclude name="**/bin/"/>
<exclude name="**/dist/"/>
<exclude name="**/nbproject/private/"/>
</zip>
</target>
</project>
and this is ide-file-targets.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project basedir=".." name="org.lejos.example-IDE">
<target name="run-selected-file-in-src">
<fail unless="run.class">Must set property 'run.class'</fail>
<ant antfile="build.xml" target="uploadandrun">
<property name="main.class" value="${run.class}"/>
</ant>
</target>
<target name="compile-selected-files-in-src">
<ant antfile="build.xml" target="compile"/>
</target>
</project>
I get this error:
run-selected-file-in-src:
clean:
Deleting directory /Users/AR/Documents/NetBeansProjects/NXJSample/build
compile:
Created dir: /Users/AR/Documents/NetBeansProjects/NXJSample/build
Compiling 1 source file to /Users/AR/Documents/NetBeansProjects/NXJSample/build
/Users/AR/Documents/NetBeansProjects/NXJSample/src/org/lejos/example/HelloWorld.java:3: package lejos.nxt does not exist
import lejos.nxt.*;
/Users/AR/Documents/NetBeansProjects/NXJSample/src/org/lejos/example/HelloWorld.java:13: cannot find symbol
symbol : variable Button
location: class org.lejos.example.HelloWorld
Button.waitForPress();
^
2 errors
/Users/AR/Documents/NetBeansProjects/NXJSample/nbproject/ide-file-targets.xml:5: The following error occurred while executing this line:
/Users/AR/Documents/NetBeansProjects/NXJSample/build.xml:24: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
[1]: http://lejos.sourceforge.net/
a little bit late but may other like me are looking for a solution. I am new on leJOS and Netbeans and Java (starting tonight).
My environment is WindowsXP with Netbeans 6.9.1.
leJOS is installed in C:/Programme/leJOS NXJ
First Project: HelloWorld
I fixed it by setting the nxj.home var in the build.properties file laying in the project root directory (here /HelloWorld/ and build.xml is also there).
The nxj.home has to point to the leJOS installation path. In my case:
nxj.home=C:/Programme/leJOS NXJ
Hope it helps
Joe.