This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 185686 - Adding groovy class to Java Project - bad ant file build-impl.xml
Summary: Adding groovy class to Java Project - bad ant file build-impl.xml
Status: RESOLVED FIXED
Alias: None
Product: groovy
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.0
Hardware: PC All
: P3 normal with 9 votes (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
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
Exception Reporter:


Attachments

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
compile:
/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>
    
    <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"/>
            <sequential>
                <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}"/>
                        </fileset>
                    </batchtest>
                    <classpath>
                        <path path="${run.test.classpath}"/>
                    </classpath>
                    <syspropertyset>
                        <propertyref prefix="test-sys-prop."/>
                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
                    </syspropertyset>
                    <formatter type="brief" usefile="false"/>
                    <formatter type="xml"/>
                    <jvmarg line="${run.jvmargs}"/>
                </junit>
            </sequential>
        </macrodef>
    </target>
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