0

I'm trying to get a Maven build working for a Java project, with the rather interesting caveat that the machine I'm building on does not have, and cannot have, access to the Maven repository.

The error I'm getting with any of the Lifecycle processes I try and run is

Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project xxxxxx: Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean failed: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.codehaus.plexus:plexus-utils:jar:1.1 has not been downloaded from it before. -> [Help 1]

Because of the disconnected nature of the machine I'm working on, I've had to have the Maven build tool manually downloaded for me, and from the error messages I've been receiving, I've also had the relevant plugins manually downloaded (maven-clean-plugin-2.5.jar for example), but I'm having trouble figuring out where to put the plugins manually so Maven can pick them up and work with them.

Dark Hippo
  • 1,255
  • 2
  • 15
  • 35
  • You need to configure a local repository that maven can access: https://maven.apache.org/guides/introduction/introduction-to-repositories.html (See point: Internal Repositories) Also: https://stackoverflow.com/questions/13834141/create-local-maven-repository – OH GOD SPIDERS Jun 26 '17 at 13:31
  • @OHGODSPIDERS I had considered this, but I setting up a networked internal repository is out of my control, plus will take quite a while to make its way through the corporate beast to actually reach fruition – Dark Hippo Jun 26 '17 at 14:17

3 Answers3

1

This looks like locked directory. Are you sure the process you are trying to build is not running, and no external program is using the project directory.

Try removing the target directory manually.

Edit: Ok, so it's actually a problem with remote maven repository.

Have you tried configuring a custom maven repo

<project>
  ...
  <repositories>
    <repository>
      <id>my-internal-site</id>
      <url>http://myserver/repo</url>
    </repository>
  </repositories>
  ...
</project>

More info here

noscreenname
  • 3,314
  • 22
  • 30
  • Tried, but didn't work. I actually have a feeling that my cutting short the error message may have changed the nature of the error. I've now included the whole error message (sorry, my bad) – Dark Hippo Jun 26 '17 at 14:10
  • @DarkHippo edit my answer after extra info about the error. – noscreenname Jun 26 '17 at 14:39
  • @noscreenname Great, thanks. Unfortunately deploying a networked internal repo isn't an option because of company politics (even typing that made me throw up a little) – Dark Hippo Jun 26 '17 at 14:55
  • @DarkHippo you can configure you repository on local filesystem: `file:// URL`. It's in the maven documentation link I've posted. – noscreenname Jun 26 '17 at 15:10
0

Yes. It looks like maven is not able to delete the working directory. Check if any process locking your directory. Else delete it manually.

0

If you building from eclipse and facing this issue then try not to check the offline mode..Please check the SS for your reference

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/34495819) – Paul Benn Jun 07 '23 at 12:16