Bug 185686 - Adding groovy class to Java Project - bad ant file build-impl.xml
Adding groovy class to Java Project - bad ant file build-impl.xml
Product: groovy
Classification: Unclassified
Component: Code
PC All
: P3 with 9 votes (vote)
: 7.2
Assigned To: Martin Janicek
Depends on:
  Show dependency treegraph
Reported: 2010-05-07 11:21 UTC by pzalews
Modified: 2011-12-08 12:11 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description pzalews 2010-05-07 11:21:45 UTC
1. create java aplication
2. add test class for Main class
3. run test - its ok 
4. add one groovy class (even empty)
5. after "test":
Compiling 1 source file to /Users/piotrzalewski/NetBeansProjects/JavaApplication5/build/classes
/Users/piotrzalewski/NetBeansProjects/JavaApplication5/nbproject/build-impl.xml:725: Unknown attributes [apgeneratedsrcdir, processorpath]
BUILD FAILED (total time: 5 seconds)
Comment 1 jmht 2010-08-18 18:18:08 UTC
May already be known, but in 6.9.1 this appears to stem from a discrepancy between the definition of the <j2seproject3:javac> macro in groovy-build.xml relative to that in build-impl.xml.  A workaround is to copy the macro from groovy-build.xml to build.xml and add the two missing attribute definitions:

   <attribute default="${javac.processorpath}" name="processorpath"/>
   <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>

(It doesn't look like these are actually used even in the "default" implementation, but they are used by the invocation points and therefore required.)

The following may also be needed information for groovy users: http://charliesquires.wordpress.com/2009/08/30/running-groovy-tests-in-netbeans-6-7-1/
Comment 2 orluke 2011-04-25 22:41:47 UTC
Are there any other workarounds besides those listed above? I'm having the same problem in Netbeans 7.0 and 6.9.1, and those workarounds listed to not work.
Comment 3 Martin Janicek 2011-12-06 07:15:08 UTC
I'm able to reproduce. This should be fixed - setting TM --> 7.2
Comment 4 Martin Janicek 2011-12-07 13:42:44 UTC
For now the easiest way to workarround the problem:

- Open groovy-build.xml
- Put these two lines right behind javac macrodef: 

<attribute default="${javac.processorpath}" name="processorpath"/>
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>

- Try to test project again - problem shouldn't occurs anymore
Comment 5 Martin Janicek 2011-12-07 13:45:34 UTC
Btw: If you workarround the issue by steps I've just described, you could still have problem with running .groovy tests together with .java tests. In that case you need to change your build.xml file and put these lines right behind import line:

<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
        <j2seproject3:junit testincludes="**/*Test.class"/>
    <target name="-init-macrodef-junit">
        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
            <attribute default="${includes}" name="includes"/>
            <attribute default="${excludes}" name="excludes"/>
            <attribute default="**" name="testincludes"/>
                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
                    <batchtest todir="${build.test.results.dir}">
                        <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
                            <filename name="@{testincludes}"/>
                        <path path="${run.test.classpath}"/>
                        <propertyref prefix="test-sys-prop."/>
                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
                    <formatter type="brief" usefile="false"/>
                    <formatter type="xml"/>
                    <jvmarg line="${run.jvmargs}"/>
Comment 6 Martin Janicek 2011-12-07 16:11:04 UTC
Fixed in: web-main #ff9e29335bea
Comment 7 Quality Engineering 2011-12-08 12:11:24 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/ff9e29335bea
User: Martin Janicek <mjanicek@netbeans.org>
Log: #185686 - Adding groovy class to Java Project - bad ant file build-impl.xml

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo