Apparent Maven / JUnit clash in eclipse [message #19255] |
Sun, 24 May 2009 21:06  |
Eclipse User |
|
|
|
Maven likes to compile test code to /target/test-classes
This isnt part of the default Build Path.
When eclipse's JUnit launcher runs, it doesnt include /target/test-classes
in its classpath, and no test classes are found.
My workaround is to add /target/test-classes to the Run Classpath of my
unit test launch shortcut.
Plus, Ive found I need to run mvn compiler:testCompile manually, because
the eclipse builder seems not to (always) build that folder automatically?
It would be nice to get better integration here eventually.
-Ben
|
|
|
Re: Apparent Maven / JUnit clash in eclipse [message #19346 is a reply to message #19255] |
Mon, 25 May 2009 13:14   |
Eclipse User |
|
|
|
Hello Ben,
BenH wrote:
> Maven likes to compile test code to /target/test-classes
> This isnt part of the default Build Path.
I have created a new maven project by using the wizard and checking the
"Create a simple maven project" checkbox.
In this project, src/main/java has its output folder set to default
(target/classes) and src/test/java has its output folder correctly set to
target/test-classes.
There might be a glitch somewhere else... can you provide more information
on how did you configure your project?
> When eclipse's JUnit launcher runs, it doesnt include /target/test-classes
> in its classpath, and no test classes are found.
This works with the simple project created above (Right-click project, Run
as, Junit Test).
> My workaround is to add /target/test-classes to the Run Classpath of my
> unit test launch shortcut.
If needed, you could set the output folder for the src/test/java source
folder (in the Java Build Path project properties).
> Plus, Ive found I need to run mvn compiler:testCompile manually, because
> the eclipse builder seems not to (always) build that folder automatically?
There have been attempts to improve performance by avoiding running maven
goals when not needed. Maybe there is some corner case that is not
properly handled.
A test case would be very welcome.
> It would be nice to get better integration here eventually.
Sure!
Feedback from the community (like yours) will allow us to achieve it.
--
Abel Muiño
|
|
|
Re: Apparent Maven / JUnit clash in eclipse [message #19574 is a reply to message #19346] |
Tue, 26 May 2009 20:53  |
Eclipse User |
|
|
|
Abel Muiño wrote:
>> Maven likes to compile test code to /target/test-classes
>> This isnt part of the default Build Path.
> I have created a new maven project by using the wizard and checking the
> "Create a simple maven project" checkbox.
> In this project, src/main/java has its output folder set to default
> (target/classes) and src/test/java has its output folder correctly set to
> target/test-classes.
Ok, I've learned something new. I didnt actually know that
per-source-folder ouput-folders was even possible.
Now, Im my project, "Allow output folders for source folders" was not
checked. But when I delete and re-import the project, it behaves correctly
as you described.
So my problem probably lay between my keyboard and chair ;)
-Ben
|
|
|
Re: Apparent Maven / JUnit clash in eclipse [message #569308 is a reply to message #19255] |
Mon, 25 May 2009 13:14  |
Eclipse User |
|
|
|
Hello Ben,
BenH wrote:
> Maven likes to compile test code to /target/test-classes
> This isnt part of the default Build Path.
I have created a new maven project by using the wizard and checking the
"Create a simple maven project" checkbox.
In this project, src/main/java has its output folder set to default
(target/classes) and src/test/java has its output folder correctly set to
target/test-classes.
There might be a glitch somewhere else... can you provide more information
on how did you configure your project?
> When eclipse's JUnit launcher runs, it doesnt include /target/test-classes
> in its classpath, and no test classes are found.
This works with the simple project created above (Right-click project, Run
as, Junit Test).
> My workaround is to add /target/test-classes to the Run Classpath of my
> unit test launch shortcut.
If needed, you could set the output folder for the src/test/java source
folder (in the Java Build Path project properties).
> Plus, Ive found I need to run mvn compiler:testCompile manually, because
> the eclipse builder seems not to (always) build that folder automatically?
There have been attempts to improve performance by avoiding running maven
goals when not needed. Maybe there is some corner case that is not
properly handled.
A test case would be very welcome.
> It would be nice to get better integration here eventually.
Sure!
Feedback from the community (like yours) will allow us to achieve it.
--
Abel Muiño
|
|
|
Re: Apparent Maven / JUnit clash in eclipse [message #569395 is a reply to message #19346] |
Tue, 26 May 2009 20:53  |
Eclipse User |
|
|
|
Abel Muiño wrote:
>> Maven likes to compile test code to /target/test-classes
>> This isnt part of the default Build Path.
> I have created a new maven project by using the wizard and checking the
> "Create a simple maven project" checkbox.
> In this project, src/main/java has its output folder set to default
> (target/classes) and src/test/java has its output folder correctly set to
> target/test-classes.
Ok, I've learned something new. I didnt actually know that
per-source-folder ouput-folders was even possible.
Now, Im my project, "Allow output folders for source folders" was not
checked. But when I delete and re-import the project, it behaves correctly
as you described.
So my problem probably lay between my keyboard and chair ;)
-Ben
|
|
|
Powered by
FUDForum. Page generated in 0.03582 seconds