[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [m2e-dev] Target folder outside project's folder -> exception
|
I think it is reasonable to patch AbstractLifecycleMapping#configure to
tolerate projectFacade.getProjectRelativePath returning null. I believe
this was the indent of the code, so the exception you get is a bug.
Please provide a quality patch (including regression tests) and I'll
review it.
To use different AbstractLifecycleMapping implementation, you need to
1. define org.eclipse.m2e.core.lifecycleMappings extension
2. in (parent) pom.xml specific m2e lifecycle mapping configuration
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<lifecycleMappings>
<lifecycleMapping>
<packagingType>...</packagingType>
<lifecycleMappingId>...</lifecycleMappingId>
</lifecycleMapping>
</lifecycleMappings>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
You will have to define mapping for all packaging types you use in your
project.
--
Regards,
Igor
On 2013-08-27 4:42 AM, Lucas Persson wrote:
Hi
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 alas 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)
The code that sort of breaks is this:
org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping,
method "configure()"
/**
* Calls #configure method of all registered project configurators
*/
public void configure(ProjectConfigurationRequest request,
IProgressMonitor mon) throws CoreException {
final SubMonitor monitor = SubMonitor.convert(mon, 5);
try {
MavenPlugin.getProjectConfigurationManager().addMavenBuilder(request.getProject(),
null /*description*/,
monitor.newChild(1));
IMavenProjectFacade projectFacade = request.getMavenProjectFacade();
MavenProject mavenProject = request.getMavenProject();
Build build = mavenProject.getBuild();
if(build != null) {
String directory = build.getDirectory();
if(directory != null) {
*IContainer container =
projectFacade.getProject().getFolder(projectFacade.getProjectRelativePath(directory));*
if(container != null) {
if(!container.exists() && container instanceof IFolder) {
M2EUtils.createFolder((IFolder) container, true,
monitor.newChild(1));
} else {
container.setDerived(true, monitor.newChild(1));
}
}
}
}
It seems that *projectFacade.getProjectRelativePath(directory) *returns
null when the pom.xml defines that the build folder is outside the
project's folder.
and that leads to exception in *projectFacade.getProject().getFolder()
*instead of returning a NULL IContainer (which the code seems to assume).
Is there a way to
"override" org.eclipse.m2e.jdt.internal.JarLifecycleMapping so I can
make my own patched version?
It seems to be a bug on this: *Bug 361824*
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=361824> -Regression[MNGECLIPSE-767]Path
must include project and resource name: /
(when this is fixed I will have to implement a project configurator that
fixes the build folder anyway but the above issue is blocking me since
project configurations are called further down in the method.)
I am using m2e version 1.4.0_20130601-0317
Thanks
Lucas
--
Lucas Persson | Principal Member of Technical Staff
Phone: +4684773644 | | | Mobile: +46730946656
Oracle Communications Platform
ORACLE Sweden | Söder Mälarstrand 29, 6 tr | 118 25 Stockholm
Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no
<http://reg.no>. 556254-6746
Oracle is committed to developing practices and products that help
protect the environment
_______________________________________________
m2e-dev mailing list
m2e-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-dev