Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Error: Path must include project and resource name

I have recently changed the setup of a project and received this error:

java.lang.IllegalArgumentException: Path must include project and
resource name: /og-analytics
    at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
    at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2069)
    at org.eclipse.core.internal.resources.Container.getFolder(Container.java:201)
    at org.eclipse.m2e.jdt.internal.AbstractJavaProjectConfigurator.isContained(AbstractJavaProjectConfigurator.java:469)
    at org.eclipse.m2e.jdt.internal.AbstractJavaProjectConfigurator.isNonOverlappingResourceDescriptor(AbstractJavaProjectConfigurator.java:461)
    at org.eclipse.m2e.jdt.internal.AbstractJavaProjectConfigurator.addResourceDirs(AbstractJavaProjectConfigurator.java:422)

It causes an error popup every time the m2e project is updated, which
is of course very annoying.

I couldn't figure out what it was at first, and tried various things.
However, I finally figured out the following.

In our corporate-pom, we had added the following:

    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>${basedir}</directory>
        <targetPath>META-INF</targetPath>
        <includes>
          <include>NOTICE.txt</include>
          <include>LICENSE.txt</include>
        </includes>
      </resource>
    </resources>
    <!-- Include NOTICE/LICENSE in test jar files -->
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
      <testResource>
        <directory>${basedir}</directory>
        <targetPath>META-INF</targetPath>
        <includes>
          <include>NOTICE.txt</include>
          <include>LICENSE.txt</include>
        </includes>
      </testResource>
    </testResources>

It is these additional resource directories, based off ${basedir} that
cause the error. When the setup is changed back to the default the
error goes away:

    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>


In my view, this setup should not cause m2e any problems (and I
believe that in Eclipse Luna it was fine). I'll leave it up to you
guys as to whether you want to treat it as a bug to be fixed or not,
as I have my solution now!

thanks
Stephen


Back to the top