Maven Run Error "maven-clean-plugin:2.5 or one of its dependencies could not be resolved"

Tayfun Yaşar picture Tayfun Yaşar · Mar 17, 2015 · Viewed 24.6k times · Source

Using İntelliJIdea, I Downloaded my project from Subversion for 12 times.

Deleted .m2/repository for 7-8 times.

Reimported, downloaded source for 15 times. Tried every possibilities but still cannot run my project.

Here is my Maven run profile and project hierarchy

project hiyerarchy

and here this is my maven output

[ERROR] 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.apache.maven.plugins:maven-clean-plugin:jar:2.5 has not been downloaded from it before. -> [Help 1]

http://paste.ubuntu.com/10613835/

There is nothing wrong with project or maven files. I'm running it on my work computer. But not in my personel.

Update1: After I deleted "-o" parameter in maven run configuration. Here is my new log Logs after deletig "-o" paramter and here is image url http://i.hizliresim.com/Lp6dDJ.png

Update2: I run this command on cmd, C:\MAYA\MAD4>mvn dependency:tree -Dverbose the result is success. And also saw C:\Users\tayfuny\.m2\repository\org\codehaus\plexus\plexus-digest\1.0\plexus-di‌​gest-1.0.jar in my dir. Here is latest maven output http://i.hizliresim.com/XBgD07.png

Answer

JBA picture JBA · Mar 17, 2015

Update: Its early in the morning here in Switzerland - i have overseen you specified the -o parameter in your run configuration in the section Command line:. This is the console parameter to let Maven work offline ;) Remove it and you should be all good. Source: http://books.sonatype.com/mvnref-book/reference/running-sect-options.html

Update 2: Alright the initial problem is solved - your log however shows two more things to fix (one of them optionally but very recomended): 1.) The warnings at the very start of the build imply you have duplicate dependency/version declarations - those should be easy fixable. You can for example use mvn dependency:tree -Dverbose to get a overview on the duplicates (and which definition takes place in the end). The second is a actuall build error. I dont know about the install plugin you are using but i guess that you are missing this dependency: http://mvnrepository.com/artifact/org.codehaus.plexus/plexus-digest/1.0 (or another one containing the class that could not be found - adjust version as needed as well).

Answer regarding offline mode:

Remove the parameter -o when running maven unless you want to work in offline mode and with your local repository only.

Another probable cause is explicitly setting Maven to work in offline mode (e.g. only consult the local repository to resolve dependencies) from within the IDE itself (which will result in calling Maven with the -o parameter behind the scenes).

General Settings/ Project Settings:

File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven

(The very first option Work offline should be deactivated/ deselected unless you realy want to work with the local repository only).

Those settings are inherited by Maven-run configurations by default but may be overwritten at two levels

Default Run Configuration:

enter image description here (Those default configs will be inherited by specific run configurations. Note that changes to the general settings apply to newly created run configurations only and will not be populated to existing ones).

Specific Run Configuration: enter image description here

Make sure none of the options is selected. In the end if you use a specific launch configuration make sure the option is not selected in that specific configuration and change the higher levels for convenience if it makes sence)