Ant Build Error in Eclipse IDE for Java - eclipse

I have been receiving the following error and have done a lot of research and tried all of the offered solutions to no avail.
junitreport:
[junitreport] Processing C:\workspace\test123\junit\TESTS-TestSuites.xml to C:\Users\Matt\AppData\Local\Temp\null1903337257
[junitreport] Loading stylesheet jar:file:/C:/Users/Matt/Documents/Selenium/eclipse/plugins/org.apache.ant_1.8.3.v20120321-1730/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
[junitreport] : Error! Cannot convert data-type 'void' to 'reference'.
[junitreport] : Fatal Error! Could not compile stylesheet
[junitreport] Failed to process C:\workspace\test123\junit\TESTS-TestSuites.xml
BUILD FAILED
C:\Users\Matt\workspace\Test1\build.xml:122: Errors while applying transformations: Fatal error during transformation
I found a solution at ant junit build error inside eclipse and saying that the issue was caused by a newer version of JDK and using 1.6_31 would solve it and I tried that following instructions I found online on how to change the version of Java eclipse is using. Every time I run the build ant it returns the same error regardless of which version of Java I am using. I have tried JRE7, jdk1.7.0_05, jdk1.6.0, jdk1.6.0_31 and others that I don't have installed anymore.
I am running the following
Windows 7 Pro SP1 x64
Eclipse IDE for Java Developers Version: Juno Release Build id: 20120614-1722
org.apache.ant_1.8.3.v20120321-1730
If anyone could provide any assistance in getting this report running it would be greatly appreciated. I'm new to programming and this is very frustrating especially since I'm still learning all of the jargon and trying to be sure I am following the instructions properly. If you require anymore information from me I will provide it and I will follow any instruction given to the best of my ability. Thank you very much in advance.

While an Ant Bug Report 384757 claims that this is caused by the XSL Tranformer build into the Oracle JDK - which may be true - the problem can be fixed by changing the Ant version:
I tried some of the workarounds mentioned there. After a while, I found that the bug appears with Ant 1.8.3 (distributed in Eclipse), but not with Ant 1.8.2 (distributed in Eclipse 3.7).
The bug also does not appear with Ant 1.9.0.
I have downloaded Ant 1.9.0 and in configured Eclipse's "Run As -> Ant build..." to use the Ant 1.9.0 folder as ANT HOME. This worked.
PS: My Eclipse used Ant 1.8.3 (which did not work), but running Ant from the console used Ant 1.8.2 (which worked). This was confusing at first.

I have solved the issue by downloading apache-ant-1.9.1 and configuring it in Eclipse by changing the ANT HOME from windows--> Preferences and setting the ANT HOME to apache-ant-1.9.1.

Below workaround fixed the build issue I had...
Download the 2 jar files from the urls given below and add those to Ant-Runtime Classpath located on Eclipse at:
Window>Preferences> Ant>Runtime>Ant Home Entries
http://www.java2s.com/Code/Jar/x/Downloadxalanjar.htm
http://www.java2s.com/Code/Jar/a/Downloadapachexmlxercesjar.htm
Restart eclipse and run the Ant build.

Related

Groovy error when doing a gradle refresh in Eclipse

I'm trying to configure Eclipse 4.5 with Gradle and Groovy. I have a more-or-less identical config (excepting later Eclipse version) as a colleague's in terms of Gradle and Groovy add-ons. But when I run Gradle->Refresh All I get a recurring error:
"Errors occurred during the build.
Errors running builder 'Java Builder' on project 'canon-qa'.
org/codehaus/jdt/groovy/integration/LanguageSupportFactory"
I've tried changing the Groovy compiler version, but nothing fixes the problem and the error message doesn't give me a lot to go on.
I recently tried configuring Eclipse 4.5.1 with the Groovy plugin found in the Eclipse marketplace (Groovy-Eclipse for Juno/Indigo 2.7.1) and ran into similar problems as you (Java Builder errors when trying to compile the Groovy code).
In order to resolve it, I had to stop using the marketplace plugin and install the groovy plugin for Eclipse 4.5 following instructions from https://github.com/groovy/groovy-eclipse/wiki (update url http://dist.springsource.org/snapshot/GRECLIPSE/e4.5/).
Not sure if this will help you but it resolved my issues.

java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/compiler/impl/CompilerOptions

I am working as an eclipse plugin developer and when I try to build my eclipse sources from command line using ant, it fails with following error.
java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/compiler/impl/CompilerOptions
I am using java 1.7_72, eclipse 44, ant 1.7.1
It was working with this configuration for long time on my machine, and it suddenly started failing with this message. I have tried various options like uninstalling and reinstalling all the possible software that could affect, gone for fresh copy of eclipse, ant and much more.
It works on my colleagues machine and we all use the same software eclipse/ant/java etc.
Any inputs are welcome.
Thanks a lot in advance.
I have been struggling with similar error using Eclipse's PDE headless product build scripts.
The error occurs when the builder executes a temporary build.xml file that it generated for my plugin. this build file compiles my plugin code.
trying to run this temporary build file manually with ant on the command line works though.
Obviously, the error suggests an issue with the JDT compiler.
Looking at the generated build.xml, I found out the following target:
<target name="properties" if="eclipse.running">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</target>
which tells the builder to override the default JDK compiler when the property eclipse.running is true.
I added
<property name="eclipse.running" value="false"/>
at the beginning of my build script: the error disappeared and my build completed successfully
In my case, the issue also appeared during PDE headless build with Eclipse Neon. The build script property (baseLocation) was pointing to a running instance of Eclipse.
Closing Eclipse before running the build resolved the issue.
The issue appeared after an update of the Target Platform. It ended up to include a newer version of Eclipse and JDT in addition to installed version.
It showed up again after update from Eclipse Neon to 2019-03 (4.14). Adding the -data <workspace>" to the eclipse launcher command-line solved it.

Grails / Groovy / GGTS: Conflicting module versions on run-app

After upgrading a Grails application from 2.2.0 to 2.2.1 I keep getting the following error when attempting to debug a Grails application from GGTS via Debug as... -> Grails Command (run-app):
Error starting Grails: nulljava.lang.ExceptionInInitializerError
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:62)
at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
at groovy.lang.Closure.<init>(Closure.java:221)
at groovy.lang.Closure.<init>(Closure.java:238)
at groovy.lang.Closure$1.<init>(Closure.java:205)
at groovy.lang.Closure.<clinit>(Closure.java:205)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.<clinit>(GrailsScriptRunner.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.0.5 and you are trying to load version 2.0.7
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerExtensionModuleFromProperties(MetaClassRegistryImpl.java:186)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerExtensionModuleFromMetaInf(MetaClassRegistryImpl.java:174)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerClasspathModules(MetaClassRegistryImpl.java:156)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:111)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:73)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:33)
... 14 more
I'm running GGTS 3.1.0.RELEASE with the Groovy Compiler 2.0 Feature 2.7.1.xx-20120921-2000-e42RELEASE and Groovy/Grails Tool Suite 3.1.0.201210061306-RELEASE-e42. The project has configured Groovy Compiler level 2.0. Eclipse Preferences say "You are currently using Groovy Compiler version 2.0.4.xx-20120921-2000-e42RELEASE".
Any hints?
i had this problem on Grails 2.2.0 on Ubuntu machine , i fixed it with the below steps :
open eclipse go to "Run as" the "Run Configurations"
choose "Environment" tab , then choose "replace native environment with specified environment "
that solved the problem for me .. hope this help
I had the same problem, I was picking up groovy-all 2.0.7 from GGTS and 2.0.8 from my grails project. To resolve the problem I removed the "Groovy Dependencies" library from the eclipse project.
Right click on project -> Properties -> Java Build Path -> Libraries (tab) -> Groovy Dependencies -> Remove
Manually delete the run-app Run Configuration so it gets recreated. This was reported as a bug on Aug. 1st, 2013. Bug report: https://issuetracker.springsource.com/browse/STS-3501
I deleted .metadata in GGTS workspace and reimport project. It works, I can run-app again.
I had the same exception, when I was trying to run JUnit tests on my Spring boot project in Eclipse only, mvn executes them fine. I'm not using Gradle or Groovy. Indeed checking the test's class path upon debug, showed two versions of groovy.jar. The work version of the groovy.jar was picked from other projects in the Eclipse workspace. I was able to fix it by removing Resolve dependencies from Workspace projects in project properties -> Maven
I had the same problem and i solved it by:
For your project: Open Run As->Run Configurations
Go to the Refresh tab
Check the Refresh resources upon completion
Press Run
That did the trick for me.
I solved it by removing the option to manually load the classpath in Run Configuration. It was using the wrong Grails version (2.5.0 instead of 2.5.1).
Basically the wrong classpath was used.
Maybe this brings someone on the correct path :)
I have no explanation why it didn't work, but I found a workaround.
I had another run target configured for the same app, but with a -Dgrails.env=... setting, which I could launch without problems. I simply copied this config and removed the parameter. That way, I basically recreated the simple launch config which previously kept failing.
Problem gone.
For me a compile from the grails command window did the trick
I had the same problem when running it through eclipse and what worked for me is to make the below changes
Go to Project properties -> Groovy Compiler ->configure workspace settings . Uncheck the checkbox "Enable checking for mismatch between project and workspace groovy compiler levels"
Another solution worked for me when Eclipse stopped being able to run my project with the "groovy-all is loaded in version ... and you are trying to load version" error.
Manually removing a groovy-all line from the .classpath fixed it.
<classpathentry kind="lib" path="Libraries/groovy-all-2.1.2.jar"/>
I found the solution in this blog post.
I had the same problem, I went to Project properties -> Groovy Compiler ->configure workspace settings and I clicked on the "Switch to" button that corresponded to one of the two versions in the error message.
I hope this will help
I know this is a GGTS question, but Google led me here and this seems to be a common issue even after several years so I'm posting this answer here. Hopefully it can help other STS users who also land here.
I had this problem with Spring Tool Suite, using Spring Boot Version 1.3.3.RELEASE and gradle version 2.14. There is some internal dependency on groovy 2.4.6 and groovy-all 2.4.6, but my Eclipse workspace Groovy Libraries are version 2.4.7. Removing the Groovy Libraries from the Spring/Gradle project properties(s) works for running those projects, but for other Groovy projects in the workspace you are stuck between a rock and a hard place. They will either run if you click yes when "Errors exist in project. Run anyway?" if you remove the Groovy libs from the properties build path, or they will not have project errors if you put the Groovy libs in the properties build path.
Resolved by adding explicit dependencies in build.gradle on groovy 2.4.7 and groovy-all 2.4.7 for Gradle projects in the workspace
compile('org.codehaus.groovy:groovy:2.4.7')
compile('org.codehaus.groovy:groovy-all:2.4.7')
and (close Eclipse STS) then removing the 2.4.6 folder(s) from the .gradle cache
<path to>\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy\2.4.6
<path to>\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy-all\2.4.6
and (Open STS) then right-click gradle project(s)>gradle>refresh gradle project
Now other Groovy projects in the workspace run without the 2.4.6 vs 2.4.7 conflict.
use mvn denpendency:tree to check your dependencies, maybe there exist version conflicts.
When I change the grails project's name it works correctly.
Currently (using Eclipse 2020-06, 4.16.0) none of the above solutions work any more.
Open the Run Configuration of your groovy script
Remove all User Entries from the Classpath tab
Press "Restore Default Entries"
This should add the default classpath containing your specified Groovy version as User Entry.

Eclipse RCP Export Product Encounters a Problem

I have a complex Eclipse Rich Client Platform GUI with 4 Eclipse plug-ins that I developed. I'm constructing it on Eclipse 3.5.2, Build id: M20100211-1343
It works just fine when I run it from inside of Eclipse as an Eclipse Application.
When I try to export the Eclipse Product using the export wizard on the Overview panel of the product file, I get this error:
'Export Product' has encountered a problem.
C:\BOPEclipse3.5RabId\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:100:
The following error occurred while executing this line:
C:\BOPEclipse3.5RabId\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:345:
C:\BOPEclipse3.5RabId\.metadata\.plugins\org.eclipse.pde.core\temp\assemblyLocation\tmp\gui\plugins\org.eclipse.equinox.launcher_1.0.201.R35x_v20090715 not found.
The following error occurred while executing this line:
C:\BOPEclipse3.5RabId\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:345:
C:\BOPEclipse3.5RabId\.metadata\.plugins\org.eclipse.pde.core\temp\assemblyLocation\tmp\gui\plugins\org.eclipse.equinox.launcher_1.0.201.R35x_v20090715 not found.
I looked at the directory location given in the error. The equinox launcher plug-in is there.
The version 1.0.201.R35x_v20090715 matches the version in the error message.
I have the equinox launcher plug-in, and the win32.win32.x86 platform fragment in the Dependencies list of the product file.
I have the "The product includes native launcher artifacts" check box in the Overview panel of the product file checked.
I have org.eclipse.equinox.launcher in the list of Required Plug-ins in the Dependencies panel of the GUI plug-in XML.
I added "javacDefaultEncoding.. = UTF-8" to the first line of the build.properties file of the GUI plug-in. (I found this advice on a Japanese blog.)
I have cleaned the plug-in projects multiple times.
Edited to add what I tried today:
I created a new Eclipse 3.5 instance. Didn't help.
I copied the workspace and tried to use Eclipse 3.6. Same error, different line numbers.
I created a Hello World RCP and tried to package it on Eclipse 3.5. Same error. I used a different workspace. Same error.
I created the same Hello World RCP and tried to package it on Eclipse 3.6. Same error.
End of today's edits.
I've searched eclipse.org and the Internet.
I'm hoping that one of you has encountered this problem before, and can point me to a solution. If I ever figure out how to solve this problem, I will post the answer.
I think I've found the solution.
I can package the Hello World RCP if I set the JRE System Library to Java 1.5. I get the error when I set the JRE System Library to Java 1.6.
It's going to take a couple of days to convert my real RCP application to Java 1.5. I hope this solves the problem.
I've reported this problem to the Eclipse Foundation. It's bug number 337,235.

Plugin classpath issues when running from IDE

I have a maven plugin that transforms class bits after compilation. This plugin works precisely as designed when run from the command line. However, the problem arises in Eclipse (3.6.1) when the Maven project is building from a clean state. What happens is that I get an error message in the console informing me that my plugin has failed due to the inability to find a class that is in fact on the classpath.
As I mentioned, this plugin works perfectly well when I build from the command line, so this is a rather annoying problem that seems a bit difficult to track down.
Has anyone else ran into this problem before, and if so, is there a solution that I'm missing?
Thanks.
I can confirm that the maven eclipse plugin sometimes works different than the "console version". You can try to change the "Preferences->Maven->Installations" to your external maven installation (that what you use when running from command line). The eclipse plugin embedded version is a 3.0-SNAPSHOT (in my installation) and maybe not stable in all points.
The issue turned out to be a difference between Maven 2.x and Maven 3.x. The m2eclipse was using a version of Maven 3.x - can't remember which - and I was running a previous version. Apparently, somewhere in the version range, the plugin mojo now requires #requiresDependencyResolution . Thus, when running in m2eclipse, my plugin was not getting any of the dependencies in the project, and thus the class path was completely boned...
word...