You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Chad Preisler <ch...@gmail.com> on 2022/05/04 13:28:46 UTC

Fwd: maven Uncompilable code

Hello,

I have a problem running tests with the maven surefire plugin. I'm not sure
what exactly triggers this issue, but I will randomly get the error below.

[ERROR] Errors:

[ERROR]   BundleProcessorTest.testBundleFilesMissingPdfFiles:54 » Runtime
Uncompilable code - cannot find symbol

  symbol:   class BundleUtil


Here are some details about my scenario.


- All my projects are configured to use groovy 4.0.2.

- I'm using JDK 17.

- All my projects are built with maven.

- I have one project that contains all of my groovy code.

- I compile the project with maven and use the maven-antrun-plugin as
documented on your site.

- I have a second project that uses the jar file generated by my groovy
project. All the code in my second project is currently Java.


If I change the code in my second project (uses the jar file from groovy
project), and run the command "mvn surefire:test" I will occasionally get
the above uncompilable code issue. Running "mvn clean install" has so far
always fixed the issue.


I should also mention that I'm using Netbeans 13 and its editor can't seem
to see the file either. It gives an error saying "can't find symbol". The
problem usually starts in the IDE, but running the maven surefire command
from the command line will produce the same error until I do a clean
install command.


I'm not sure how to "fix" this issue. I can't tell at this point if the
issue is in maven, surefire, Netbeans, or Groovy. Has anyone run into this
before? I can provide more information and config/code snippets if it will
help diagnose the issue.


Thanks,

Chad

Re: Fwd: maven Uncompilable code

Posted by Jochen Theodorou <bl...@gmx.org>.
On 04.05.22 15:28, Chad Preisler wrote:
> Hello,
>
[...maven surefire, groovy 4.0.2, JDK 17...]
> [ERROR] Errors:____
>
> [ERROR]   BundleProcessorTest.testBundleFilesMissingPdfFiles:54 »
> Runtime Uncompilable code - cannot find symbol____
>
>    symbol:   class BundleUtil
[...]
> - I compile the project with maven and use the maven-antrun-plugin as
> documented on your site.
>
> - I have a second project that uses the jar file generated by my groovy
> project. All the code in my second project is currently Java.

You can then probably easily exclude Groovy as the culprit by checking
if the jar contains the missing class.

> If I change the code in my second project (uses the jar file from groovy
> project), and run the command "mvn surefire:test" I will
> occasionally get the above uncompilable code issue. Running "mvn clean
> install" has so far always fixed the issue.

I had my fair share of maven install trouble in the past. More than once
I had a broken install of the project, with then very strange errors. I
suggest to go to the maven install directory (usually ~/.m2/repostory)
and there remove all of the project based directories for the Groovy and
the Java part. Or you just throw away the whole thing. I learned in the
past that the use for a "maven install" is very limited ... Sorry that
is me ranting from having spend almost 2 days on an issue that was maven
install just last week.

if "maven clean install" fixes the issue, then maybe it is really
related to the compilation itself you should try if "maven package" or
something the like works in building the app without anything installed

> I should also mention that I'm using Netbeans 13 and its editor can't
> seem to see the file either. It gives an error saying "can't find
> symbol". The problem usually starts in the IDE, but running the maven
> surefire command from the command line will produce the same error until
> I do a clean install command.

Is there a chance of Netbeans using the same classes directory as is
configured for your maven build and that it is interfering?

> I'm not sure how to "fix" this issue. I can't tell at this point if the
> issue is in maven, surefire, Netbeans, or Groovy. Has anyone run into
> this before? I can provide more information and config/code snippets if
> it will help diagnose the issue.

Testing if it is Netbeans could be easy.. run it a couple of times
without the ide open. Though I don't know how easy it is to reproduce.

bye Jochen