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 241985 - A Maven Java project can't recognize a groovy class in the same package
Summary: A Maven Java project can't recognize a groovy class in the same package
Status: NEW
Alias: None
Product: groovy
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-17 07:45 UTC by thruminds
Modified: 2014-02-19 00:28 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Maven project with a groovy class (8.11 KB, application/octet-stream)
2014-02-17 10:31 UTC, thruminds
Details

Note You need to log in before you can comment on or make changes to this bug.
Description thruminds 2014-02-17 07:45:43 UTC

    
Comment 1 Milos Kleint 2014-02-17 08:00:46 UTC
do you have a sample project?
Comment 2 thruminds 2014-02-17 10:31:46 UTC
Created attachment 145296 [details]
Maven project with a groovy class

This is the Maven project I created for the Test Case in Synergy:
http://services.netbeans.org/synergy/client/app/#/case/5293/suite/1512/v/1

There are a couple of things worth mentioning here:
1- When a Maven Java project is created it doesn't have a main class. Is this the normal case?
2- When I created a class with a main method, the project refused to work unless its refactored to the default naming with non-Maven Java projects.
3- If the Groovy class of the test case was created in Groovy packages, it can't be accessible from the main class created in the Java packages. I had to move it to the same package to run: succeeded on Ubuntu but still fails on Windows.
Comment 3 Milos Kleint 2014-02-17 13:49:11 UTC
reassigning to groovy support, I'm not sure if the attached project setup is currently supported
Comment 4 Martin Janicek 2014-02-17 13:56:36 UTC
(In reply to thruminds from comment #2)
> There are a couple of things worth mentioning here:
> 1- When a Maven Java project is created it doesn't have a main class. Is
> this the normal case?

Ye, that's normal.

> 2- When I created a class with a main method, the project refused to work
> unless its refactored to the default naming with non-Maven Java projects.

Not sure I understand, what do you mean by "the project refused to work" ? What it does when you run project (or main class) ?

I tried it with simple project and running main class results in successful build and correct execution (note: I used New File -> Java Main Class, it is the same as you, right?).

> 3- If the Groovy class of the test case was created in Groovy packages, it
> can't be accessible from the main class created in the Java packages. I had
> to move it to the same package to run: succeeded on Ubuntu but still fails
> on Windows.

Could you please describe me exact class (you can refer attached project) where you tried to use Groovy class and it didn't work ?


Sorry for so many questions but it seems that we are mixing few different things together here and I'm a bit confused because of that ;)
Comment 5 thruminds 2014-02-19 00:28:21 UTC
(In reply to Martin Janicek from comment #4)
> (In reply to thruminds from comment #2)
> > There are a couple of things worth mentioning here:
> > 1- When a Maven Java project is created it doesn't have a main class. Is
> > this the normal case?
> 
> Ye, that's normal.
> 
> > 2- When I created a class with a main method, the project refused to work
> > unless its refactored to the default naming with non-Maven Java projects.
> 
> Not sure I understand, what do you mean by "the project refused to work" ?
> What it does when you run project (or main class) ?
> 
> I tried it with simple project and running main class results in successful
> build and correct execution (note: I used New File -> Java Main Class, it is
> the same as you, right?).
> 
> > 3- If the Groovy class of the test case was created in Groovy packages, it
> > can't be accessible from the main class created in the Java packages. I had
> > to move it to the same package to run: succeeded on Ubuntu but still fails
> > on Windows.
> 
> Could you please describe me exact class (you can refer attached project)
> where you tried to use Groovy class and it didn't work ?
> 
> 
> Sorry for so many questions but it seems that we are mixing few different
> things together here and I'm a bit confused because of that ;)

Hi,
Regarding Question #2:The project didn't start, giving me the following output

------------------------------------------------------------------------
Building mavenproject2 1.0-SNAPSHOT
------------------------------------------------------------------------

--- exec-maven-plugin:1.2.1:exec (default-cli) @ mavenproject2 ---
Exception in thread "main" java.lang.NoClassDefFoundError: com/mycompany/mavenproject2/NewGroovyClass
	at com.mycompany.mavenproject2.MavenProject1.main(MavenProject1.java:19)
Caused by: java.lang.ClassNotFoundException: com.mycompany.mavenproject2.NewGroovyClass
	at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 1 more
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.378s
Finished at: Wed Feb 19 02:09:47 GMT+02:00 2014
Final Memory: 7M/163M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project mavenproject2: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

and yes, I created a new Java main class using the new file dialog -> Java Main Class.

Regarding your last question, you can refer to the test specification in the link in my comment above and the attached zip file that contains the project I  created and has the problem (to help reproduce the bug).

Thanks :)