Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » IAM (Eclipse Integration for Apache Maven) » Apparent Maven / JUnit clash in eclipse
Apparent Maven / JUnit clash in eclipse [message #19255] Mon, 25 May 2009 01:06 Go to next message
BenH is currently offline BenHFriend
Messages: 39
Registered: July 2009
Member
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 17:14 Go to previous messageGo to next message
Abel Mui is currently offline Abel MuiFriend
Messages: 247
Registered: July 2009
Senior Member
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] Wed, 27 May 2009 00:53 Go to previous message
BenH is currently offline BenHFriend
Messages: 39
Registered: July 2009
Member
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 17:14 Go to previous message
Abel Mui is currently offline Abel MuiFriend
Messages: 247
Registered: July 2009
Senior Member
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] Wed, 27 May 2009 00:53 Go to previous message
BenH is currently offline BenHFriend
Messages: 39
Registered: July 2009
Member
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
Previous Topic:Installation Failure
Next Topic:Installation Failure
Goto Forum:
  


Current Time: Thu Apr 25 11:27:45 GMT 2024

Powered by FUDForum. Page generated in 0.03091 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top