OFBiz
  1. OFBiz
  2. OFBIZ-4783

./ant can't find the cobertura class

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Trunk
    • Fix Version/s: Trunk
    • Component/s: framework
    • Labels:

      Description

      ./ant can't find the cobertura class, and deactivate the code coverage function.
      in framework/base/build.xml:

              <condition property="exclude.cobertura" value="org/ofbiz/base/config/Cobertura*.java">
                  <not>
                      <available classname="net.sourceforge.cobertura.instrument.ClassInstrumenter" classpathref="local.class.path"/>
                  </not>
              </condition>
      

        Issue Links

          Activity

          Hide
          Jacques Le Roux added a comment -

          This was actually fixed by Adam, see OFBIZ-4757. I'm not sure if something was not introduced since because the cobertura-base.dat and cobertura-components.dat files are not generated with run-tests

          Show
          Jacques Le Roux added a comment - This was actually fixed by Adam, see OFBIZ-4757 . I'm not sure if something was not introduced since because the cobertura-base.dat and cobertura-components.dat files are not generated with run-tests
          Hide
          Erwan de FERRIERES added a comment -

          using revision 889900 (just after cobertura integration), the problem is already present. In fact, it seems it never works...

          clean-svninfo:
          [echo] Resetting svninfo...
          [echo] Done!
          [echo] [build] ========== Done Building (Compile) ==========

          run-tests:
          [java] Set OFBIZ_HOME to - /home/erwan/workspace/ofbiz889838
          [java] java.lang.ClassNotFoundException: org.ofbiz.base.config.CoberturaInstrumenter
          [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
          [java] at java.security.AccessController.doPrivileged(Native Method)
          [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
          [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
          [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
          [java] at org.ofbiz.base.start.InstrumenterWorker.instrument(InstrumenterWorker.java:39)
          [java] at org.ofbiz.base.start.Classpath.instrument(Classpath.java:92)
          [java] at org.ofbiz.base.start.Start.initClasspath(Start.java:228)
          [java] at org.ofbiz.base.start.Start.init(Start.java:87)
          [java] at org.ofbiz.base.start.Start.main(Start.java:410)
          [java] Admin socket not configured; set to port 0
          [java] 2012-04-12 19:19:19,666 (main) [ ContainerLoader.java:50 :INFO ] [Startup] Loading containers...

          Show
          Erwan de FERRIERES added a comment - using revision 889900 (just after cobertura integration), the problem is already present. In fact, it seems it never works... clean-svninfo: [echo] Resetting svninfo... [echo] Done! [echo] [build] ========== Done Building (Compile) ========== run-tests: [java] Set OFBIZ_HOME to - /home/erwan/workspace/ofbiz889838 [java] java.lang.ClassNotFoundException: org.ofbiz.base.config.CoberturaInstrumenter [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:202) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:190) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:247) [java] at org.ofbiz.base.start.InstrumenterWorker.instrument(InstrumenterWorker.java:39) [java] at org.ofbiz.base.start.Classpath.instrument(Classpath.java:92) [java] at org.ofbiz.base.start.Start.initClasspath(Start.java:228) [java] at org.ofbiz.base.start.Start.init(Start.java:87) [java] at org.ofbiz.base.start.Start.main(Start.java:410) [java] Admin socket not configured; set to port 0 [java] 2012-04-12 19:19:19,666 (main) [ ContainerLoader.java:50 :INFO ] [Startup] Loading containers...
          Hide
          Adrian Crum added a comment -

          It might help to learn the differences between the ant version bundled with your OS and the ant version bundled with OFBiz. In particular, see what changed in the <available> element between those versions.

          Pierre - Framework code MUST have good unit tests and those tests MUST have good code coverage. Before Adam made these test improvements, OFBiz was very buggy and the bugs were difficult to track down.

          Cobertura has an incompatible license, so we can not include it in OFBiz.

          Show
          Adrian Crum added a comment - It might help to learn the differences between the ant version bundled with your OS and the ant version bundled with OFBiz. In particular, see what changed in the <available> element between those versions. Pierre - Framework code MUST have good unit tests and those tests MUST have good code coverage. Before Adam made these test improvements, OFBiz was very buggy and the bugs were difficult to track down. Cobertura has an incompatible license, so we can not include it in OFBiz.
          Hide
          Pierre Smits added a comment -

          We should ask ourselves why we do want the java code related to cobertura in our codebase.

          And whether incorporating the jar would not be enough...

          Show
          Pierre Smits added a comment - We should ask ourselves why we do want the java code related to cobertura in our codebase. And whether incorporating the jar would not be enough...
          Hide
          Erwan de FERRIERES added a comment -

          for testing:

              <path id="test.class.path">
                  <fileset dir="framework/base/lib" includes="*.jar"/>
              </path>
          
              <target name="test-cob" depends="ofbiz-init">
                  <condition property="exclude.cobertura" value="org/ofbiz/base/config/Cobertura*.java">
                      <not>
                          <available classname="net.sourceforge.cobertura.instrument.ClassInstrumenter"
                                     property="exclude.cobertura"
                                     classpathref="test.class.path"/>
                      </not>
                  </condition>
                  <condition property="exclude.cobertura2" value="org/ofbiz/base/config/Cobertura*.java">
                      <not>
                          <available file="cobertura-1.9.4.1.jar" classpathref="test.class.path"/>
                      </not>
                  </condition>
                  <echo message="${exclude.cobertura}"/>
                  <echo message="${exclude.cobertura2}"/>
              </target>
          
          Show
          Erwan de FERRIERES added a comment - for testing: <path id= "test.class.path" > <fileset dir= "framework/base/lib" includes= "*.jar" /> </path> <target name= "test-cob" depends= "ofbiz-init" > <condition property= "exclude.cobertura" value= "org/ofbiz/base/config/Cobertura*.java" > <not> <available classname= "net.sourceforge.cobertura.instrument.ClassInstrumenter" property= "exclude.cobertura" classpathref= "test.class.path" /> </not> </condition> <condition property= "exclude.cobertura2" value= "org/ofbiz/base/config/Cobertura*.java" > <not> <available file= "cobertura-1.9.4.1.jar" classpathref= "test.class.path" /> </not> </condition> <echo message= "${exclude.cobertura}" /> <echo message= "${exclude.cobertura2}" /> </target>

            People

            • Assignee:
              Adam Heath
              Reporter:
              Erwan de FERRIERES
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development