0

我已经使用以下选项在 Eclipse 中检查了一个 Maven 项目:

Import > Maven > Check out Maven Projects from SCM

当我尝试使用以下方法构建项目时:

Project > Clean

我收到以下错误:

Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".

堆栈跟踪:

java.lang.IllegalArgumentException: Path must include project and resource name: /
    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.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.mavenProjectChanged(AbstractMavenArchiverConfigurator.java:178)
    at org.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.mavenProjectChanged(AbstractMavenArchiverConfigurator.java:170)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.mavenProjectChanged(ProjectConfigurationManager.java:905)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.notifyProjectChangeListeners(ProjectRegistryManager.java:732)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.applyMutableProjectRegistry(ProjectRegistryManager.java:855)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:279)
    at org.eclipse.m2e.core.internal.project.registry.MavenProjectManager.refresh(MavenProjectManager.java:58)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:87)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

会话数据:

eclipse.buildId=M20130204-1200
java.version=1.7.0_17
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product

我看不出配置有任何问题。其他人已经检查了这个项目而没有这个错误。我不知道当它说“路径必须包括...”时它指的是什么我在哪里可以配置这个路径?

4

1 回答 1

2

这是由本地定义的名为 $BROOT 的环境变量引起的,该变量设置在 ~/.bashrc 中,然后由 maven pom.xml 拾取。环境变量把项目的输出目录放到了eclipse工作区之外,这不是Eclipse喜欢做的事情。

解决方案是取消设置环境变量。这就是它在 Windows 中工作的原因,因为 Windows 对 ~/.bashrc 一无所知。

于 2013-04-05T04:05:16.973 回答