Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plugin org.apache.maven.plugins:maven-dependency-plugin:3.1 or one of its dependencies could not be resolved

I'm creating a web application using NetBeans. I'm new to both NetBeans and creating web applications. So I'll be honest, I'm not exactly sure what's happening.

While trying to run the default hello world index.jsp, I run into the error :

Plugin org.apache.maven.plugins:maven-dependency-plugin:3.1 or one of its dependencies could not be resolved: org.apache.maven.plugins:maven-dependency-plugin:jar:3.1 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

Full Log:

Deploying on Apache Tomcat or TomEE
    profile mode: false
    debug mode: false
    force redeploy: true
Starting Tomcat process...
Waiting for Tomcat...
Starting of Tomcat failed.
cd C:\Users\Thomas\Desktop\INF 124\assignment-4-team-19\inf124site; "JAVA_HOME=C:\\Program Files\\Java\\jdk-19" cmd /c "\"C:\\Program Files\\NetBeans-17\\netbeans\\java\\maven\\bin\\mvn.cmd\" -Dnetbeans.deploy=true -Dexec.vmArgs= -Dexec.appArgs= \"-Dmaven.ext.class.path=C:\\Program Files\\NetBeans-17\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" --no-transfer-progress package"
Scanning for projects...

----------------------< com.mycompany:inf124site >----------------------
Building inf124site 1.0-SNAPSHOT
--------------------------------[ war ]---------------------------------
The POM for org.apache.maven.plugins:maven-dependency-plugin:jar:3.1 is missing, no dependency information available
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time:  0.076 s
Finished at: 2023-03-23T12:46:27-07:00
------------------------------------------------------------------------
Plugin org.apache.maven.plugins:maven-dependency-plugin:3.1 or one of its dependencies could not be resolved: org.apache.maven.plugins:maven-dependency-plugin:jar:3.1 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

My pom file:

project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>inf124site</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>inf124site</name>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>6.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.9.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.1</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>6.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

So far I've tried some stuff I've seen on here.

  1. Updating the version numbers in my pom file.
  2. Reinstalling Maven.
  3. Performing mvn clean install -U (which fails and creates its own error)
  4. deleting different versions of various folders in maven under C:\Users\Thomas.m2\repository\org\apache\maven\plugins
  5. recreating the NetBeans project
  6. Trying different version of java (19 -> 17)

All I'm trying to do is display a simple hello world webpage so that I can further develop a page. Not sure what to do. I appreciate any guidance!

like image 403
treynol Avatar asked Feb 03 '26 17:02

treynol


1 Answers

Silly mistake but its version is 3.1.0 not 3.1, also 3.5.0 is available I recommend using the newest version(Since there is very low chance of bugs).

like image 64
acrastt Avatar answered Feb 05 '26 07:02

acrastt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!