2012-08-30 49 views
0

我建立了使用maven我的java程序從內部Eclipse和我遇到了以下錯誤:編譯java程序會導致FileNotFound錯誤在Eclipse

Caused by: java.io.FileNotFoundException: C:\Users\BennyJ\workspace\Tom\common\target\classes (Access is denied) 
at java.io.FileInputStream.open(Native Method) 
at java.io.FileInputStream.<init>(FileInputStream.java:106) 
at  org.codehaus.plexus.util.io.FileInputStreamFacade.getInputStream(FileInputStreamFacade.java:39) 
at org.codehaus.plexus.util.FileUtils.copyStreamToFile(FileUtils.java:1106) 
at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1013) 
at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:293) 
at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask$1.registered(AbstractWarPackagingTask.java:150) 
at org.apache.maven.plugin.war.util.WebappStructure.registerFile(WebappStructure.java:211) 
at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:145) 
at org.apache.maven.plugin.war.packaging.ArtifactsPackagingTask.performPackaging(ArtifactsPackagingTask.java:106) 
... 27 more 

作爲一個更新,運行Eclipse作爲管理員解決問題。但是,現在它給出了一個新的錯誤如下:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project client: Compilation failure 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure 
    at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656) 
    at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
    ... 19 more` 

這是什麼原因造成的?

+1

也許你需要以管理員身份運行Eclipse? – Brian

+0

你是absolutley正確運行eclipse管理員解決了問題但現在它給出了一個新的錯誤,如下所示: – MindBrain

+1

什麼是新的錯誤? – HypnoticSheep

回答

1

確保您的當前用戶具有訪問該文件所需的權限。如果他們這樣做,確保沒有其他線程,程序或用戶對必要的文件有鎖定。