Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ant javac task is unable to find CloverCompilerAdapter class #75

Closed
marek-parfianowicz opened this issue Dec 17, 2019 · 1 comment
Closed
Labels
Milestone

Comments

@marek-parfianowicz
Copy link
Member

@marek-parfianowicz marek-parfianowicz commented Dec 17, 2019

Affects OpenClover version 4.3.0. Stack trace:

BUILD FAILED

Class not found: com.atlassian.clover.ant.taskdefs.CloverCompilerAdapter at org.apache.tools.ant.util.ClasspathUtils.newInstance(ClasspathUtils.java:257) at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.resolveClassName(CompilerAdapterFactory.java:196) at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:157) at org.apache.tools.ant.taskdefs.Javac.findSupportedFileExtensions(Javac.java:984) at org.apache.tools.ant.taskdefs.Javac.scanDir(Javac.java:961) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:932) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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:435) at org.apache.tools.ant.Target.performTasks(Target.java:456) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) at org.apache.tools.ant.Project.executeTarget(Project.java:1364) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1248) at org.apache.tools.ant.Main.runBuild(Main.java:851) at org.apache.tools.ant.Main.startAnt(Main.java:235) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Caused by: java.lang.ClassNotFoundException: com.atlassian.clover.ant.taskdefs.CloverCompilerAdapter at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1374) at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1323) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1076) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.apache.tools.ant.util.ClasspathUtils.newInstance(ClasspathUtils.java:249) ... 21 more

Cause:

In 4.3.0 we have removed CloverEnvTask which was adding clover.jar to bootclasspath (as in JDK9 such hack is no longer allowed). This clover.jar was used to load high-level targets (like "with.clover"), which can be easily declared in Ant build.xml.

Side effect is that the Ant task is unable to find the CloverCompilerAdapter specified in the build.compiler property - the classloader sees Ant JARs only...

Workaround:

Copy clover.jar to ANT_HOME\lib directory.

Fix:

See http://openclover.org/doc/manual/latest/ant--adding-to-ants-classpath.html

@marek-parfianowicz

This comment has been minimized.

Copy link
Member Author

@marek-parfianowicz marek-parfianowicz commented Dec 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.