[jira] [Commented] (GROOVY-8775) Bug joint compilation in ant task groovyc: package does not exist

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (GROOVY-8775) Bug joint compilation in ant task groovyc: package does not exist

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/GROOVY-8775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16613271#comment-16613271 ]

Paul King commented on GROOVY-8775:
-----------------------------------

Thanks, yes I could replicate also with Maven 3.5.4. This is something we haven't fixed for JDK9+ yet but there is a workaround.

Details: we create the classpath for javac based on all the jars that the groovyc classloader knows about. That way it covers jars that might have been @Grab'd and/or potentially added via a custom compilation configuration script. We do it by walking up the classloader hierarchy and extract jars from URLClassloaders. This has changed in JDK9 where URLClassloaders aren't returned any more and for a full solution we'd need to potentially traverse all modules on the module path as well as the classpath. We are still working on that.

In the meantime, you can provide an explicit classpath setting to javac and we don't do the above process:
{code}
...
<javac encoding="utf-8" debug="true">
    <compilerarg value="-JclasspathOverride=${toString:compile-lib}"/>
</javac>
...
{code}

> Bug joint compilation in ant task groovyc: package does not exist
> -----------------------------------------------------------------
>
>                 Key: GROOVY-8775
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8775
>             Project: Groovy
>          Issue Type: Bug
>          Components: Ant integration
>    Affects Versions: 2.5.2
>            Reporter: Sergey Kravchenko
>            Priority: Blocker
>         Attachments: groovyc-ant-bugs.zip
>
>
> Bug joint compilation in ant task groovyc: package does not exist
> javac compiles normally java-files.
>  groovyc compiles normally groovy-files only.
>  groovyc with nested element javac - error: package does not exist
> java 10.0.2
>  groovy 2.5.2
>  OS Windows 7
> On java 8 - all ok
> Example project in attachments
> Prepare:
> {code:java}
> mvn dependency:copy-dependencies
> {code}
> Error compile:
> {code:java}
> ant build.joint
> {code}
> Normal compile:
> {code:java}
> ant build.java
> ant build.groovy
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)