Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Target folder outside project's folder -> JUnit does not work


I have defined that the target folder (and target/classes) shall be outside the project's folder.
The reason to have it like this is that I am using a proprietary SCM which do not allow write access unless a file is checkout out.
And als it does not have any type of "ignore" filter.

The thing is that every time I do "Maven->Update Project..." it fails like this:

An internal error occurred during: "Updating Maven Project".
Path must include project and resource name: /tiget-api

java.lang.IllegalArgumentException: Path must include project and resource name: /tiget-api
	at org.eclipse.core.runtime.Assert.isLegal(
	at org.eclipse.core.internal.resources.Workspace.newResource(
	at org.eclipse.core.internal.resources.Container.getFolder(
	at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(

I am not sure what m2e does here but I guess it is updating the output folder (among other things)

It seems that if I do not use target folders outside the project's folder the "Maven->Update Project..." succeeds.

The real only issue I can see after that "Maven->Update Project..." fails is that when I try to run JUnit then the Junit launch classpath is not including the target/classes and target/test-classes folders. So JUnit will always end up in class not found for the test class.

So in the root pom(parent pom) I have something like this:	



And in order to make sure the both Eclipse and Maven compiles to same output folder I have it like this in .classpath and .project

  <classpathentry kind="src" path="src/main/java"/>
  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
  <classpathentry kind="output" path="target/classes"/>

<?xml version="1.0" encoding="UTF-8"?>

And M2_TARGET is a Eclipse "Linke resource" path variable which all developers in my team needs to defined in their workspace.

So this works very well until we started to use m2e plugin for dependency management.

So basically is there some way to configure m2e to for instance not updating the output folder?
Or can I make some sort of extension to m2e to fix this?

I am using m2e plugin of 1.4 in Eclipse Indigo


Back to the top