[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [m2e-users] Target folder outside project's folder -> JUnit does not work
- From: Lucas Persson <lucas.persson@xxxxxxxxxx>
- Date: Thu, 22 Aug 2013 16:34:47 +0200
- Delivered-to: email@example.com
I will happily receive pointer to implement a java project configurator.
22 aug 2013 kl. 16:10 skrev Igor Fedorenko <igor@xxxxxxxxxxxxxx>:
> It is not possible to configure m2e to do what you want and generally
> m2e only supports projects that are fully contained under their base
> directory. You should be able to implement alternative java project
> configurator that will configure classpath like you need. I can provide
> pointers on m2e-dev if you want to try.
> On 2013-08-22 9:20 AM, Lucas Persson wrote:
>> 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(Assert.java:63)
>> at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2163)
>> at org.eclipse.core.internal.resources.Container.getFolder(Container.java:222)
>> at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:71)
>> 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
>> m2e-users mailing list
> m2e-users mailing list