Eclipse中的Resolve workspace artifacts选项会在打开其中一个解析项目时生成错误

时间:2015-06-17 10:31:15

标签: java eclipse maven artifact hotdeploy

我有一个maven项目A,有4个子模块。我有另一个maven项目B,没有任何子模块。 A的4个子模块之一,参考项目B。

当我在项目A上清理安装时,收到错误消息:

[错误]无法在项目dca-web上执行目标org.apache.maven.plugins:maven-war-plugin:2.2:war(default-war):无法复制工件文件[be.vlaanderen.dwse :dwse-doc-tools:jar:3.2.2:compile]:/ Users / Fabrizio / ontwikkeling / projecten / doc-tools / target / classes(是一个目录)

启用调试信息时:很明显是什么问题:

[错误]无法在项目dca-web上执行目标org.apache.maven.plugins:maven-war-plugin:2.2:war(default-war):无法复制工件文件[be.vlaanderen.dwse :dwse-doc-tools:jar:3.2.2:compile]:/ Users / Fabrizio / ontwikkeling / projecten / doc-tools / target / classes(是一个目录) - > [帮助1] org.apache.maven.lifecycle.LifecycleExecutionException:无法在项目dca-web上执行目标org.apache.maven.plugins:maven-war-plugin:2.2:war(default-war):无法复制工件文件[be .vlaanderen.dwse:dwse-DOC工具中:jar:3.2.2:编译]     在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)     在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)     在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)     在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)     在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)     在org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)     在org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)     在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)     在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)     在org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)     在org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)     在org.apache.maven.cli.MavenCli.main(MavenCli.java:160)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:483)     在org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)     在org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)     在org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)     在org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

引起:org.apache.maven.plugin.MojoExecutionException:无法复制工件文件[be.vlaanderen.dwse:dwse-doc-tools:jar:3.2.2:compile]     在org.apache.maven.plugin.war.packaging.ArtifactsPackagingTask.performPackaging(ArtifactsPackagingTask.java:131)     在org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.handleArtifacts(WarProjectPackagingTask.java:190)     在org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.performPackaging(WarProjectPackagingTask.java:109)     在org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:472)     在org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:404)     在org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:215)     在org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:177)     在org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)     在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)     ......还有19个

引起:java.io.FileNotFoundException:/ Users / Fabrizio / ontwikkeling / projecten / doc-tools / target / classes(是目录)     at java.io.FileInputStream.open(Native Method)     在java.io.FileInputStream。(FileInputStream.java:138)     at org.codehaus.plexus.util.io.FileInputStreamFacade.getInputStream(FileInputStreamFacade.java:36)     在org.codehaus.plexus.util.FileUtils.copyStreamToFile(FileUtils.java:1141)     在org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1048)     在org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:293)     在org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask $ 1.registered(AbstractWarPackagingTask.java:150)     在org.apache.maven.plugin.war.util.WebappStructure.registerFile(WebappStructure.java:211)     在org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:145)     在org.apache.maven.plugin.war.packaging.ArtifactsPackagingTask.performPackaging(ArtifactsPackagingTask.java:106)

但是文件夹target / classes是一个目录!所以我猜其中一个maven插件中有一个错误......

当我关闭项目B时,没有问题。因此,打开引用的项目会产生问题......

我需要打开项目B,因为我在Tomcat中使用项目A作为Web应用程序。当我打开项目B并更改文件并保存它时,Eclipse会进行增量发布,因此Tomcat不需要重新部署或重新启动!这样可以节省每次30秒的文件更改!因此,保持这个项目开放是非常重要的......

1 个答案:

答案 0 :(得分:3)

我找到了解决方案。显然,eclipse luna(或任何基于eclipse luna的ide)使用嵌入式版本的maven,后者又使用maven-war-plugin 2.2版本。在我的pom中添加2.6版后,它解决了这个问题!

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
        </plugin>
    </plugins>
</build>