11

So I just created a Linux instance from EC2 and now I'm trying to install the AWS Java SDK on it. I'm at the end of the installation when I run mvn clean compile exec:java and get this:

[ec2-user@ip-xxx-xxx-xxx-xxx aws-java-sample]$ mvn clean compile exec:java
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building aws-java-sample 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ aws-java-sample ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ aws-java-sample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: x.xxx s
[INFO] Finished at: xxxx-xx-xxTxx:xx:xx+xx:xx
[INFO] Final Memory: M/xM
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project aws-java-sample: Cannot create resource output directory: /home/ec2-user/aws-java-sample/target/classes -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

I've seen the question similar to this on Stack Overflow, but that is using Windows as its host where I'm using a Linux instance. Plus that answer involves configuration with Eclipse, which I am not using. I'm not sure why it's behaving like this nor know how to fix it.

alexwlchan
  • 5,699
  • 7
  • 38
  • 49
user2361174
  • 1,872
  • 4
  • 33
  • 51
  • Do you have parent directory `/home/ec2-user/aws-java-sample/target/`? Do you have write permission to that dircetory? – SMA Apr 19 '15 at 07:31
  • Nope, I ran the command `ls -l` and the permissions for it was `d--------- 6 root root 4096 Apr 19 xx:xx aws-java-sample`. I tried changing the permissions but kept on getting this message `chmod: changing permissions of âaws-java-sample/â: Operation not permitted` – user2361174 Apr 20 '15 at 00:09
  • Do you have `sudo`rights? – xerx593 Apr 29 '15 at 16:02

3 Answers3

8

I my case this error appeared when I had target directory opened in console (so maven cannot delete it).
Navigating out of the target folder allowed me to install via maven without a problem.

pbaranski
  • 22,778
  • 19
  • 100
  • 117
2

I solved when close opened folder of proyect in windows

Jhon Jesus
  • 315
  • 2
  • 14
-1

Try to Disable the automatic build of your IDE maybe there is some conflict with the Maven build. Verify also that the folder is not open somewhere with explorer or some other applications In case it doesn't work just restart your IDE

Lho Ben
  • 2,053
  • 18
  • 35