Search code examples
javamavenvaadinlifecycle

Failed to copy artifact or file with maven packaging a web application


I have a problem packaging a web application based on vaadin. I have two projects in my workspace called project A and project B. Project A is referencing B and the dependencies are resolven within the workspace and degub mode correctly, by adding the project to the classpath.

Now if I try to maven package, I always get the error

Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project A: Failed to copy file for artifact [com.dscsag.dscxps:ProjectB:jar:0.0.1-SNAPSHOT:compile]: C:\some_path\target\classes (Access is denied) -> [Help 1]

What should I do?


Solution

  • It seems to relate with security because the log said "(Access is denied)". Maybe the output jar of project B exists and there are some processes still reading from it, so that you cannot overwrite the output file. Or maven doesn't have the appropriate privilege to write the output file to the class folder.