Skip to Content

Error on compile

Posted in

When running a task to compile a project the following error appears:

BUILD FAILED
C:\CS_Build\CS_Builder\build.xml:356: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:359: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:377: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:391: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:180: Class not found: org.ant4eclipse.ant.jdt.ecj.EcjCompilerAdapter

I didnt have any issue with the task until today when opened the project.

I have set up in the class path the org.ant4eclipse_1.0.0.M4.jar, ecj-3.6.jar, org.eclipse.osgi_3.6.0.v20100517.jar and ant-contrib-1.0b3.jar

Thanks in advance for any help!

The task in question is the following:

<target name="compile.project" if="executeJdtProject.source.directories">
 
		<echo>Compiling jdt project '${executeJdtProject.project.name}'</echo>
		<echo>  - source directories -> ${executeJdtProject.source.directories}</echo>
		<echo>  - output directory   -> ${executeJdtProject.default.output.directory}</echo>
		<echo>  - bootclasspath      -> ${executeJdtProject.boot.classpath}</echo>
		<echo>  - classpath          -> ${executeJdtProject.classpath.absolute.compiletime}</echo>
 
		<mkdir dir="${executeJdtProject.default.output.directory}" />
 
		<javac destdir="${executeJdtProject.default.output.directory}" debug="on" 
			bootclasspath="${sun.boot.class.path}"
			compiler="org.ant4eclipse.ant.jdt.ecj.EcjCompilerAdapter">
 
			<src refid="executeJdtProject.source.directories.path" />
			<bootclasspath refid="executeJdtProject.boot.classpath.path" />
			<classpath refid="executeJdtProject.classpath.absolute.compiletime.path" />
 
			<compilerarg value="compiler.args.refid=executeJdtProject.compiler.args" compiler="org.ant4eclipse.ant.jdt.ecj.EcjCompilerAdapter" />
 
			<compilerarg value="compiler.options.file=${executeJdtProject.project.directory}/.settings/org.eclipse.jdt.core.prefs" compiler="org.ant4eclipse.ant.jdt.ecj.EcjCompilerAdapter" />
 
			<compilerarg value="compiler.options.file.overrideJavacTask=true" compiler="org.ant4eclipse.ant.jdt.ecj.EcjCompilerAdapter" />
 
		</javac>
 
	</target>

That's another issue

Obviously the originally posted issue is gone now. Your current problem is related to the classpath. I've noticed before that the file ''.project'' is on your classpath which is very odd.
Could you give us the ''.classpath'' file ?

Bye
Kasimir

issue with the classpath

Hi Kasimir.

Im going to put this this in a new post because the issue is different.

Yes it appears to be a new issue with the classpath of the project being compiled (CommonUtils), which its including the builder project directories (this was not happening before).

In the project that contains the builder.xml I do not have a .classpath file, however here it is the classpath for the project being compiled (CommonUtils):

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
	<classpathentry kind="var" path="JBOSS_INSTALL/jboss-as/server/default/deployers/esb.deployer/lib/jbossesb-rosetta.jar" sourcepath="/ROSETTA_SOURCE"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre6">
		<attributes>
			<attribute name="owner.project.facets" value="jst.java"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="lib" path="/ESBLibraries/esbcontent/lib/commons-lang-2.5.jar"/>
	<classpathentry kind="con" path="org.jboss.esb.runtime.classpath/server.supplied/JBoss EAP 5.0 Runtime"/>
	<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/JBoss EAP 5.0 Runtime"/>
	<classpathentry kind="var" path="JBOSS_INSTALL"/>
	<classpathentry kind="output" path="bin"/>
</classpath>

Thanks for any insight this might provide.

Hi, what Ant version are you

Hi,

what Ant version are you using?

Ant Version

Its the one that come with Eclipse I think is 1.7.1. The problem is that this error was not appeared and I was not changing the Eclipse configuration.

This is the output with -debug on:

Complete build sequence is [compile.project, generate.source, generate.jar, init, clean, prepare, build.library, getProjectFromST, generate.war, build.distribution, copy.resources, processBuildType, build.cs, getAllProjectsFromST, build.project, generate.esb, test, to.merge.directory, ]
compile.project:
[echo] Compiling jdt project 'CommonUtils'
[echo] - source directories -> C:\CS_Build\CommonUtils\src
[echo] - output directory -> C:\CS_Build\CommonUtils\bin
[echo] - bootclasspath -> C:\Program Files\Java\jre6\lib\resources.jar;C:\Program Files\Java\jre6\lib\rt.jar;C:\Program Files\Java\jre6\lib\jsse.jar;C:\Program Files\Java\jre6\lib\jce.jar;C:\Program Files\Java\jre6\lib\charsets.jar;C:\Program Files\Java\jre6\lib\ext\dnsns.jar;C:\Program Files\Java\jre6\lib\ext\localedata.jar;C:\Program Files\Java\jre6\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jre6\lib\ext\sunmscapi.jar;C:\Program Files\Java\jre6\lib\ext\sunpkcs11.jar
[echo] - classpath -> C:\CS_Build\CommonUtils\bin;C:\CS_Build\CS_Builder\.project;C:\CS_Build\CS_Builder\build.xml;C:\CS_Build\CS_Builder\default-build.properties;C:\CS_Build\CS_Builder\lib\Borland.StarTeam.Encryption.dll;C:\CS_Build\CS_Builder\lib\Borland.StarTeam.Environment.dll;C:\CS_Build\CS_Builder\lib\Borland.StarTeam.FileAccess02.dll;C:\CS_Build\CS_Builder\lib\Borland.StarTeam.Profile.dll;C:\CS_Build\CS_Builder\lib\StarTeamSDK104.de.dll;C:\CS_Build\CS_Builder\lib\StarTeamSDK104.dll;C:\CS_Build\CS_Builder\lib\StarTeamSDK104.fr.dll;C:\CS_Build\CS_Builder\lib\StarTeamSDK104.ini;C:\CS_Build\CS_Builder\lib\StarTeamSDK104.ja.dll;C:\CS_Build\CS_Builder\lib\ant-contrib-1.0b3.jar;C:\CS_Build\CS_Builder\lib\ecj-3.5.2.jar;C:\CS_Build\CS_Builder\lib\jnlp-servlet.jar;C:\CS_Build\CS_Builder\lib\jsch-0.1.44.jar;C:\CS_Build\CS_Builder\lib\org.ant4eclipse_1.0.0.M4.jar;C:\CS_Build\CS_Builder\lib\org.eclipse.osgi_3.5.2.R35x_v20100126.jar;C:\CS_Build\CS_Builder\lib\ss.jar;C:\CS_Build\CS_Builder\lib\starteam104-resources.jar;C:\CS_Build\CS_Builder\lib\starteam104.jar;C:\CS_Build\CS_Builder\lib\starteam104_win32.jar;C:\CS_Build\CS_Builder\lib\swingall.jar;C:\CS_Build\CS_Builder\not_used.xml;C:\CS_Build\CS_Builder\project.properties;C:\CS_Build\CS_Builder\user.properties;C:\jboss-soa-p.5.0.0\jboss-as\server\default\deployers\esb.deployer\lib\jbossesb-rosetta.jar;C:\CS_Build\ESBLibraries\esbcontent\lib\commons-lang-2.5.jar;C:\jboss-soa-p.5.0.0
[mkdir] Skipping C:\CS_Build\CommonUtils\bin because it already exists.
fileset: Setup scanner in dir C:\CS_Build\CommonUtils\src with patternSet{ includes: [] excludes: [] }
[javac] C:\CS_Build\CommonUtils\src\META-INF\MANIFEST.MF skipped - don't know how to handle it
[javac] com\hp\cs\common\Constants.java added as com\hp\cs\common\Constants.class doesn't exist.
[javac] com\hp\cs\common\CustomLogger.java added as com\hp\cs\common\CustomLogger.class doesn't exist.
[javac] com\hp\cs\common\EndLogAction.java added as com\hp\cs\common\EndLogAction.class doesn't exist.
[javac] com\hp\cs\common\LogAction.java added as com\hp\cs\common\LogAction.class doesn't exist.
[javac] com\hp\cs\common\SimpleNamespaceContext.java added as com\hp\cs\common\SimpleNamespaceContext.class doesn't exist.
[javac] com\hp\cs\common\StartLogAction.java added as com\hp\cs\common\StartLogAction.class doesn't exist.
[javac] com\hp\cs\common\UniqueIdGen.java added as com\hp\cs\common\UniqueIdGen.class doesn't exist.
[javac] com\hp\cs\common\Util.java added as com\hp\cs\common\Util.class doesn't exist.
[javac] com\hp\cs\common\XMLUtils.java added as com\hp\cs\common\XMLUtils.class doesn't exist.
[javac] com\hp\cs\ie\esb\NewMessageMulticaster.java added as com\hp\cs\ie\esb\NewMessageMulticaster.class doesn't exist.
[javac] com\hp\cs\ie\esb\actions\CopyMessagePayload.java added as com\hp\cs\ie\esb\actions\CopyMessagePayload.class doesn't exist.
[javac] com\hp\cs\ie\esb\actions\JMSRequestReplyInvoker.java added as com\hp\cs\ie\esb\actions\JMSRequestReplyInvoker.class doesn't exist.
[javac] com\hp\cs\ie\esb\actions\NewMessageStaticWiretap.java added as com\hp\cs\ie\esb\actions\NewMessageStaticWiretap.class doesn't exist.
[javac] com\hp\cs\ie\esb\actions\SyncServiceInvoker.java added as com\hp\cs\ie\esb\actions\SyncServiceInvoker.class doesn't exist.
[javac] com\hp\cs\ie\esb\soap\MessageMerger.java added as com\hp\cs\ie\esb\soap\MessageMerger.class doesn't exist.
[javac] com\hp\cs\ie\esb\soap\SOAPEnvelopCreator.java added as com\hp\cs\ie\esb\soap\SOAPEnvelopCreator.class doesn't exist.
[javac] com\hp\cs\ie\esb\soap\SOAPEnvelopStripper.java added as com\hp\cs\ie\esb\soap\SOAPEnvelopStripper.class doesn't exist.
[javac] com\hp\cs\ie\message\MergedMessage.java added as com\hp\cs\ie\message\MergedMessage.class doesn't exist.
[javac] com\hp\cs\ie\message\ObjectFactory.java added as com\hp\cs\ie\message\ObjectFactory.class doesn't exist.
[javac] com\hp\cs\ie\message\package-info.java added as com\hp\cs\ie\message\package-info.class doesn't exist.
[javac] com\hp\cs\ie\response\ErrorMessage.java added as com\hp\cs\ie\response\ErrorMessage.class doesn't exist.
[javac] com\hp\cs\ie\response\ErrorResponse.java added as com\hp\cs\ie\response\ErrorResponse.class doesn't exist.
[javac] com\hp\cs\ie\response\ObjectFactory.java added as com\hp\cs\ie\response\ObjectFactory.class doesn't exist.
[javac] com\hp\cs\ie\response\package-info.java added as com\hp\cs\ie\response\package-info.class doesn't exist.
[javac] Compiling 24 source files to C:\CS_Build\CommonUtils\bin
[antcall] Exiting C:\CS_Build\CS_Builder\build.xml.
[antcall] Exiting C:\CS_Build\CS_Builder\build.xml.

BUILD FAILED
C:\CS_Build\CS_Builder\build.xml:461: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:464: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:481: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:495: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:277: Class not found: org.ant4eclipse.ant.jdt.ecj.EcjCompilerAdapter
at org.ant4eclipse.ant.core.AbstractAnt4EclipseTask.execute(AbstractAnt4EclipseTask.java:67)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:464: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:481: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:495: The following error occurred while executing this line:
C:\CS_Build\CS_Builder\build.xml:277: Class not found: org.ant4eclipse.ant.jdt.ecj.EcjCompilerAdapter
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:397)
at org.ant4eclipse.ant.platform.core.delegate.MacroExecutionDelegate.executeMacroInstance(MacroExecutionDelegate.java:170)
at org.ant4eclipse.ant.platform.core.delegate.MacroExecutionDelegate.executeMacroInstance(MacroExecutionDelegate.java:129)
at org.ant4eclipse.ant.platform.ExecuteProjectSetTask.doExecute(ExecuteProjectSetTask.java:180)
at org.ant4eclipse.ant.core.AbstractAnt4EclipseTask.execute(AbstractAnt4EclipseTask.java:65)
... 15 more

A4E not in sync with the doc

Hi Danton30,

I'm sorry for this fault. The EcjCompilerAdapter is in fact missing for version 1.0.0.M4 which is correct as it didn't exist when this release has been published. So the fault is the code snippet you've obviously used is to modern (it was my fault that the documentation has already been published and might be misleading here).
So there should be two possibilities for you:

1. Use 'JDTCompilerAdapter' instead of 'EcjCompilerAdapter'.
This is basically the same.

2. Use the most recent ant4eclipse distribution which can be downloaded using the hudson site.

Please let us know whether this helped or not.

Bye
Daniel Kasmeroglu

Could not create jar file

Hi Daniel and thanks for your quick response.

The structure of the project is as follows:

_CSBuilder (this contains the build.xml)
   + lib
   + workspace
      + CommonUtils
      + ESBLibraries
      + ... (other projects)

The idea is to build the projects under the workspace folder.

I changed the references of "EcjCompilerAdapter" with "JDTCompilerAdapter",

However when I run the build.xml, I receive the following:

BUILD FAILED
C:\_CSBuilder\_CSBuilder\build.xml:456: The following error occurred while executing this line:
C:\_CSBuilder\_CSBuilder\build.xml:459: The following error occurred while executing this line:
C:\_CSBuilder\_CSBuilder\build.xml:476: The following error occurred while executing this line:
C:\_CSBuilder\_CSBuilder\build.xml:490: The following error occurred while executing this line:
C:\_CSBuilder\_CSBuilder\build.xml:272: org.ant4eclipse.lib.core.exception.Ant4EclipseException: Could not create jar file from file 'C:\_CSBuilder\_CSBuilder\.project'.

Total time: 18 seconds

Not sure why the compile task is trying to include the references to the _CSBuilder project (which only contains the build.xml) in the compilation of the CommonUtils project

Thanks in advance for your help!