Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-dev] Target folder outside project's folder -> exception

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 - 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. 556254-6746 
 Oracle is committed to developing practices and products that help protect the environment


Back to the top