havapa / testability-explorer

Automatically exported from code.google.com/p/testability-explorer
Apache License 2.0
0 stars 0 forks source link

ant task fails with guice creation errors #44

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
hercule 1673 $ ll lib/
total 4388
-rw-rw-r--    1 clements ofacdev      9755 Aug 21 01:19 ant-task-1.3.2.jar
-rw-rw-r--    1 clements ofacdev   4480690 Aug 21 01:18
testability-explorer-1.3.2-with-deps.jar
hercule 1674 $ cat build.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<project default="report">

    <path id="classpath">
        <fileset dir="lib" includes="*.jar"/>
    </path>
    <taskdef name="testability" classname="com.google.ant.TestabilityTask"
classpathref="classpath"/>

    <target name="report" >
              <testability  filter="" resultfile="report.html"
errorfile="testability.err.txt"
                            printdepth="2" print="html" mincost="1"
maxexcellentcost="50"
                            maxacceptablecost="100" worstoffendercount="25"
whitelist=""
                            cyclomatic="1" global="10"
failproperty="testability.failproperty">
                <classpath>
                    <pathelement path="log4j.1.2.15.jar"/>
                </classpath>
    </testability>

    </target>

</project>
hercule 1675 $ ant -f build.xml
Buildfile: build.xml

report:

BUILD FAILED
com.google.inject.CreationException: Guice creation errors:

1) No implementation for com.google.classpath.ClassPath was bound.
  while locating com.google.classpath.ClassPath
    for parameter 1 at
com.google.test.metric.JavaTestabilityRunner.<init>(JavaTestabilityRunner.java:5
4)
  at
com.google.test.metric.TestabilityModule.configure(TestabilityModule.java:20)

2) No implementation for com.google.classpath.ClassPath was bound.
  while locating com.google.classpath.ClassPath
    for parameter 0 at
com.google.test.metric.ReportGeneratorProvider.<init>(ReportGeneratorProvider.ja
va:73)
  at
com.google.test.metric.TestabilityModule.configure(TestabilityModule.java:21)

3) No implementation for
com.google.test.metric.ReportGeneratorProvider$ReportFormat was bound.
  while locating com.google.test.metric.ReportGeneratorProvider$ReportFormat
    for parameter 4 at
com.google.test.metric.ReportGeneratorProvider.<init>(ReportGeneratorProvider.ja
va:73)
  at
com.google.test.metric.TestabilityModule.configure(TestabilityModule.java:21)

4) No implementation for com.google.test.metric.WhiteList was bound.
  while locating com.google.test.metric.WhiteList
    for parameter 5 at
com.google.test.metric.JavaTestabilityRunner.<init>(JavaTestabilityRunner.java:5
4)
  at
com.google.test.metric.TestabilityModule.configure(TestabilityModule.java:20)

5) No implementation for com.google.test.metric.WhiteList was bound.
  while locating com.google.test.metric.WhiteList
    for parameter 2 at
com.google.test.metric.MetricComputer.<init>(MetricComputer.java:40)
  while locating com.google.test.metric.MetricComputer
    for parameter 3 at
com.google.test.metric.JavaTestabilityRunner.<init>(JavaTestabilityRunner.java:5
4)
  at
com.google.test.metric.TestabilityModule.configure(TestabilityModule.java:20)

6) No implementation for java.io.PrintStream annotated with
@com.google.test.metric.ConfigModule.Error() was bound.
  while locating java.io.PrintStream annotated with
@com.google.test.metric.ConfigModule.Error()
    for parameter 6 at
com.google.test.metric.JavaTestabilityRunner.<init>(JavaTestabilityRunner.java:5
4)
  at
com.google.test.metric.TestabilityModule.configure(TestabilityModule.java:20)

7) No implementation for java.io.PrintStream annotated with
@com.google.test.metric.ConfigModule.Error() was bound.
  while locating java.io.PrintStream annotated with
@com.google.test.metric.ConfigModule.Error()
    for parameter 1 at
com.google.test.metric.MetricComputer.<init>(MetricComputer.java:40)
  while locating com.google.test.metric.MetricComputer
    for parameter 3 at
com.google.test.metric.JavaTestabilityRunner.<init>(JavaTestabilityRunner.java:5
4)
  at
com.google.test.metric.TestabilityModule.configure(TestabilityModule.java:20)

8) No implementation for java.io.PrintStream annotated with
@com.google.test.metric.ConfigModule.Output() was bound.
  while locating java.io.PrintStream annotated with
@com.google.test.metric.ConfigModule.Output()
    for parameter 2 at
com.google.test.metric.ReportGeneratorProvider.<init>(ReportGeneratorProvider.ja
va:73)
  at
com.google.test.metric.TestabilityModule.configure(TestabilityModule.java:21)

9) No implementation for java.lang.Integer annotated with
@com.google.inject.name.Named(value=printDepth) was bound.
  while locating java.lang.Integer annotated with
@com.google.inject.name.Named(value=printDepth)
    for parameter 3 at
com.google.test.metric.MetricComputer.<init>(MetricComputer.java:40)
  while locating com.google.test.metric.MetricComputer
    for parameter 3 at
com.google.test.metric.JavaTestabilityRunner.<init>(JavaTestabilityRunner.java:5
4)
  at
com.google.test.metric.TestabilityModule.configure(TestabilityModule.java:20)

10) No implementation for java.util.List<java.lang.String> was bound.
  while locating java.util.List<java.lang.String>
    for parameter 4 at
com.google.test.metric.JavaTestabilityRunner.<init>(JavaTestabilityRunner.java:5
4)
  at
com.google.test.metric.TestabilityModule.configure(TestabilityModule.java:20)

11) No implementation for com.google.classpath.ClassPath was bound.
  at
com.google.test.metric.TestabilityModule.getClassRepo(TestabilityModule.java:25)

11 errors
        at
com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.jav
a:354)
        at
com.google.inject.InjectorBuilder.initializeStatically(InjectorBuilder.java:152)
        at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:105)
        at com.google.inject.Guice.createInjector(Guice.java:92)
        at com.google.inject.Guice.createInjector(Guice.java:69)
        at com.google.inject.Guice.createInjector(Guice.java:59)
        at
com.google.ant.TestabilityTask.runTestabilityExplorer(TestabilityTask.java:135)
        at com.google.ant.TestabilityTask.execute(TestabilityTask.java:110)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:43)
        at java.lang.reflect.Method.invoke(Method.java:615)
        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.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.Main.runBuild(Main.java:758)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 1 second

hercule 1677 $ ant -version
Apache Ant version 1.7.1 compiled on June 27 2008

Original issue reported on code.google.com by markdcle...@gmail.com on 2 Oct 2009 at 12:03

GoogleCodeExporter commented 8 years ago
Any idea how we can get this fixed or prioritised? Im not sure what the problem 
is,
or I would fix it myself.

Original comment by gro...@gmail.com on 9 Feb 2010 at 10:38

GoogleCodeExporter commented 8 years ago
I've created an Ant project to reproduce the error. Simply extract the tar.gz 
archive 
and run "ant" to reproduce.

Does anybody have any pointers for why this would be failing?

Original comment by gro...@gmail.com on 9 Feb 2010 at 9:24

Attachments:

GoogleCodeExporter commented 8 years ago
I'm having the same problem.

Original comment by cem...@gmail.com on 27 May 2010 at 5:05

GoogleCodeExporter commented 8 years ago
I only seem to get this error on an IBM JDK running on Linux. Where are you 
seeing
this error?

Original comment by gro...@gmail.com on 27 May 2010 at 8:36

GoogleCodeExporter commented 8 years ago
I see the error with IBM JVMs for Java 5 and Java 6 on AIX, an IBM JVM Java 5 on
Windows and the Sun Java 5 and 6 JVMs on Windows.

C:\tmp\BBB>ant -v
Apache Ant version 1.7.1 compiled on June 27 2008
Buildfile: build.xml
Detected Java version: 1.5 in: c:\OtherPrograms\Java\jdk1.5.0_17\jre
Detected OS: Windows XP

C:\tmp\BBB>ant -v
Apache Ant version 1.7.1 compiled on June 27 2008
Buildfile: build.xml
Detected Java version: 1.6 in: c:\Java\jdk1.6.0_18\jre
Detected OS: Windows XP

hercule 5288 $ ant -v
Apache Ant version 1.7.1 compiled on June 27 2008
Buildfile: build.xml
Detected Java version: 1.6 in: /usr/java6/jre
Detected OS: AIX

hercule 5293 $ ant -v
Apache Ant version 1.7.1 compiled on June 27 2008
Buildfile: build.xml
Detected Java version: 1.5 in: /usr/java5/jre
Detected OS: AIX

Original comment by markdcle...@gmail.com on 27 May 2010 at 9:36

GoogleCodeExporter commented 8 years ago
I just tried on Windows XP JDK 5 and 6. I get the same errors. So Im guessing 
that
this means the Ant task no longer works at all? Since a failure on 3 OSes and 2 
Java
versions is a fairly comprehensive failure across the board.

C:\Documents and Settings\U0101483\Desktop\test-guice-err.tar\test-guice-error>a
nt -v
Apache Ant version 1.7.1 compiled on September 23 2008
Buildfile: build.xml
Detected Java version: 1.5 in: C:\apps\Java\jdk1.5.0_12\jre
Detected OS: Windows XP

C:\Documents and Settings\U0101483\Desktop\test-guice-err.tar\test-guice-error>a
nt -v
Apache Ant version 1.7.1 compiled on September 23 2008
Buildfile: build.xml
Detected Java version: 1.6 in: C:\apps\Java\jdk1.6.0_11\jre
Detected OS: Windows XP

Original comment by gro...@gmail.com on 27 May 2010 at 9:51

GoogleCodeExporter commented 8 years ago
I've taken a quick look at the MavenMojo and the AntTask. It looks like a lot 
more
binding is going on in the MavenMojo. Perhaps all that is missing is similar 
Guice
binding to be done for the AntTask? Im no Guice expert, but I will try poke 
around
tonight when I get home.

Original comment by gro...@gmail.com on 27 May 2010 at 10:10

GoogleCodeExporter commented 8 years ago
有解决方案吗?

Original comment by michael....@gmail.com on 10 Aug 2010 at 8:17

GoogleCodeExporter commented 8 years ago
Is there any work around for this issue?

Original comment by jason.ve...@gmail.com on 22 Oct 2010 at 4:05

GoogleCodeExporter commented 8 years ago
Just hit this bug too, looks like it's been around for a while.

Original comment by luke.noe...@integrate.co.uk on 24 Feb 2011 at 4:13

GoogleCodeExporter commented 8 years ago
I'm seeing the same errors...

java-1.5.0-ibm-1.5.0.12.3.x86_64

java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pxa64devifx-20110211b 
(SR12 FP3 +IZ94331))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux amd64-64 
j9vmxa6423ifx-20101130 (JIT enabled)
J9VM - 20101129_69669_LHdSMr
JIT  - 20100623_16197ifx1_r8
GC   - 20100211_AA)
JCL  - 20110208

2.6.18-128.el5 SMP x86_64 GNU/Linux

Apache Ant(TM) version 1.8.2 compiled on December 20 2010

Original comment by waressc...@gmail.com on 6 Apr 2011 at 6:27

GoogleCodeExporter commented 8 years ago
this is such frequent error but nobody seems to have / post a solution.
is this a configuration issue or a bug?

Original comment by sjoshi...@gmail.com on 8 Jul 2011 at 4:58

GoogleCodeExporter commented 8 years ago
this is also coming on 
Detected Java version: 1.6 in: C:\Program Files\Java\jre6
Detected OS: Windows Server 2008 R2

Please fix this issue asap or comment on any configuration changes to be done

Original comment by venugo...@cordys.com on 17 Sep 2011 at 8:08

GoogleCodeExporter commented 8 years ago
This is just a workaround but works fine:

        <java classname="com.google.test.metric.Testability" fork="yes" output="${testability.dir}/testability.result.html" error="${testability.dir}/err.txt">
            <classpath>
                <pathelement location="${ant.lib.ext}/testability-explorer-1.3.2-with-deps.jar"/>
            </classpath>
            <arg value="-cp"/>
            <arg value="${classes.dir}"/>
            <arg value="-print"/>
            <arg value="html"/>
        </java> 

Original comment by rmaugu...@gmail.com on 23 Nov 2011 at 1:21