Vinita Gupta
Vinita Gupta

Reputation: 113

Error resolving version for plugin 'org.apache.maven.plugins:maven-jar-plugin' from the repositories ,Plugin not found in any plugin repository

I am trying to Maven build my Java project but it is getting failed and i am getting below error:

Error resolving version for plugin 'org.apache.maven.plugins:maven-jar-plugin' from the repositories [local (C:\Users\Vinita.Gupta.m2\repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]

I am trying to build the project in Eclipse Neon and have installed and setup Maven path,m2connector for Eclipse.

Note: I am not connected to network using any proxy Most of the solutions which i have found online were having issues due to proxy settings but i am directly connected to network and able to browse below directory via browser but couldn't connect through Maven: https://repo.maven.apache.org/maven2

Please help !!

Upvotes: 11

Views: 82675

Answers (7)

vivek lad
vivek lad

Reputation: 1

Added this to pom.xml and update project. Worked for me.


<build>
    <finalName>spring-security-demo</finalName>
    <pluginManagement>
        <plugins>
            <plugin>
            
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.2.0</version>
            
            </plugin>
        </plugins>
    
    </pluginManagement>
    
    </build>

Upvotes: 0

chris dany
chris dany

Reputation: 450

Add this to your pom.xml and it should work

<pluginRepositories>
   <pluginRepository> 
    <id>maven2</id> 
    <url>https://repo.maven.apache.org/maven2/</url> 
  </pluginRepository> 
</pluginRepositories>

Upvotes: 4

Venkady
Venkady

Reputation: 39

Check settings.xml file is available in C:\Users\username.m2\settings.xml and change below C:/Users/username/.m2/repository

Its worked for me.

Upvotes: 0

Chibsta
Chibsta

Reputation: 11

What worked for me was to add a Proxy Bypass for repo.maven.apache.org under ‘Window’ > ‘Preferences’ > ‘General’ > ‘Network connections’.

After that I ran into compilation errors related to certain classes not being resolved. Just did a clean and build, viola Build Successful!

Upvotes: 0

3xCh1_23
3xCh1_23

Reputation: 1499

Spent a day working on it, finally, the solution was to change the URL in settings.xml of a .m2 directory

old line was:

<url>http://blah:8081/bla/blabla/</url>

However, for a reason unknown to me, and from my machine only, the URL was getting rejected. As a result, I was getting the error mentioned in a title... Therefore, the solution was to put the full URL such as:

<url>http://blah.org.blah:8081/bla/blabla/</url>

-Then, simply re-open IDE (if using it), update the project (build, clean or whatever else is necessary to refresh).

You may also need to specify <port> or to add the proxy settings, but none of that was required in my case. Therefore, the solution is about adjusting the settings.xml. I have tried adding the version numbers as suggested and it was a partial solution. Cleaning and updating the project (without the settings.xml change) did nothing. Removing *.lastUpdated from .m2 was not a solution either.

Upvotes: 0

Seetharaman Mohan
Seetharaman Mohan

Reputation: 141

I had a weird solution. I got the same error when i was connected in Office LAN. Once I switched to common wifi, the error was not thrown. So i believe this is more to do with the network restriction.

Upvotes: 2

manuelvigarcia
manuelvigarcia

Reputation: 2094

I had the same error, but for the maven-failsafe-plugin.

With the help of a colleague, we got rid of the problem adding the version line to the plugin declaration in the project pom.xml. We added the <version>2.20.1</version> line resulting in the following plugin declaration.

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.20.1</version>
                <configuration>
                    <skipTests>false</skipTests>
                    <argLine>-Djava.library.path=${project.parent.basedir}/lib/${arquitecturaMaquina}</argLine>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

It is a long working project (over a year) and never had this error. I do not know what triggered it, but all the other answers about resetting the local repository, checking the proxy, etc did not work.

Then we added that version line to the pom.xml and the project built correctly again. Now I removed the line and it is still working. My guess is that it indeed had something to do with some messed up cache of some kind, and that requiring the specific version got rid of the mess and now it is working as before the problem appeared.

Upvotes: 10

Related Questions