0

Hello I am new to Java & Maven. I'm trying to build a project locally and keep getting the same error:

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-clean-plugin:jar:2.5 in nexus http://x.x.x.x:xxxx/nexus/content/groups/public) -> [Help 1]

I checked in my nexus repository in that directory and we do not have a 2.5 folder for maven-clean-plugin. However, I have searched the POM.xml and project files and no where do I see that it defines 2.5 as a dependency. So why does it keep looking for 2.5? What are some different ways I could fix it aside from putting 2.5 on the nexus?

SamZamXam
  • 13
  • 4
  • 1
    possible duplicate of [What are the difference between pom.xml and effective pom in Apache Maven?](http://stackoverflow.com/questions/26114768/what-are-the-difference-between-pom-xml-and-effective-pom-in-apache-maven) – azurefrog Oct 10 '14 at 16:49
  • I'm not seeing anything in the super pom that would cause this behavior? – SamZamXam Oct 10 '14 at 16:58
  • Where are you looking? If you look at your effective pom, you will have a 'maven-clean-plugin' that defines 'clean', a 'maven-install-plugin' that defines 'install', and so on. All these basic tasks are automatically defined for any pom.xml you write. – azurefrog Oct 10 '14 at 17:05
  • I have my M2_HOME pointed at a Maven 3.2.3 installation. When I do a text search in the pom-4.0.0.xml I find no references to the word "clean", and within the project's pom.xml there are no references to the plugin.. Still unsure where this could be coming from? Let me know if there is any additional information about my setup if it could reveal something more useful. – SamZamXam Oct 10 '14 at 17:10
  • If you don't want to use version 2.5, you can always add your own maven-clean-plugin declaration in your pom.xml and specify a different version number. – azurefrog Oct 10 '14 at 17:10
  • I can't speak to your specific installation, but for a more in-depth explanation, you should take a look at [maven's introduction to the pom](http://maven.apache.org/guides/introduction/introduction-to-the-pom.html). – azurefrog Oct 10 '14 at 17:13
  • I read through a lot of the Maven documentation - especially that around the POM, but not having found anything revealing is why I am now here. While digging around for your suggestions I thought of something... My best guess is that the clean plugin is tied in with the version of STS tools suite I'm using (3.6.1) and thus is defaulting to 2.5. And so... when 3.6.1 requests using version 2.5 Maven goes out to the project's mirror for all plugins in settings.xml, which doesn't have maven-clean 2.5. The problem only occurs after I import the project into STS 3.6.1, but not 3.4.0... – SamZamXam Oct 10 '14 at 17:19
  • Well. I just ruled that last guess out by attempting to build the project from the command line before importing it to any IDE. I still get the "Failure to find" error. My next best guess is the version of Maven I'm using.. – SamZamXam Oct 10 '14 at 17:24
  • Also check your local repo. Sometimes stale files there cause problems. – lexicore Oct 10 '14 at 18:49
  • This is giving me a headache.. I just deleted my .m2 folder, re-ran the build and voila! maven-clean-plugin:2.5 is there! Then when I deleted the .m2 folder again, I get the error! I apologize for letting this slip out, but I'm beginning to question whether Java is worth the effort of learning/getting into. – SamZamXam Oct 10 '14 at 19:03
  • So you are learning Java / Maven / Eclipse in one step ? Oh my lord this will fail, cause you should start learning with a single part...and than going to the next step.. – khmarbaise Oct 11 '14 at 13:18

1 Answers1

1

The first thing is based on your post that you didn't pinned the versions of your plugins in your own build which means Maven itself takes care of it and it uses those version which a defined in Maven itself which you can read in the following documentations:

which means if you change the Maven version it happen that versions of the plugins to be used is changed. So it's really necessary to defined the used plugin versions via a pluginManagement within a company pom.

Furthermore your message shows me that you seemed to be having some problems to access either your internal repository manager cause it can't download the needed artifacts which should be solved.

Update: (Missing maven-clean-plugin)

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • This was very helpful. Although I am glad this shed a bit of light on the network issues, which we are looking into now.. I can't help but feel a bit frustrated by the lack of information about this from Maven. When I look at the default bindings for the version of Maven I didn't see anything for maven-clean. – SamZamXam Oct 10 '14 at 22:13
  • updated my answer according to missing information for maven-clean-plugin. – khmarbaise Oct 11 '14 at 13:30