0

I am trying to build a simple web API using dynamic web maven project.

When I run my project as maven project with the goals of clean install. I get this error:

Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Cannot access https://repo.maven.apache.org/maven2 with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access https://repo.maven.apache.org/maven2 using the registered transporter factories: WagonTransporterFactory: java.util.NoSuchElementException

role: org.apache.maven.wagon.Wagon

Here is my POM file, it might be useful as it is where the dependencies are stated:

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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>group5</groupId>
  <artifactId>studentService</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  
  <properties>
    <maven.compiler.source>7</maven.compiler.source>
    <maven.compiler.target>7</maven.compiler.target>
</properties>

<dependencies>
    <!-- https://mvnrepository.com/artifact/org.apache.axis/axis -->
    <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
    </dependency>
    <!--  https://mvnrepository.com/artifact/javax.xml.rpc/javax.xml.rpc-api -->
    <dependency>
        <groupId>javax.xml.rpc</groupId>
        <artifactId>javax.xml.rpc-api</artifactId>
        <version>1.1.2</version>
    </dependency>
    <!--  https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-rt -->
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.2.6</version>
    </dependency>
</dependencies>
  

   
  
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.2.3</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

I am aware of this question: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved

However the proxy solution did not work for me. (I have never made a proxy before). Any help appreciated.

Lyra Orwell
  • 1,048
  • 4
  • 17
  • 46
  • I think without further information this question needs to be closed as duplicate of the cited question because the problem is the same. And it is likely that this some kind of network or firewall issue. – J Fabian Meier Mar 22 '21 at 10:19
  • BTW: Are you sure you want to use Java 7? – J Fabian Meier Mar 22 '21 at 10:20
  • @J Fabian Meier yes I need to use jdk version 7 as I'm using an older web server. What other information would you like me to provide? – Lyra Orwell Mar 22 '21 at 10:22
  • This looks weird: ` transporter factories: WagonTransporterFactory: java.util.NoSuchElementException` apart from that if you are using JDK7 you have to change the configuration to use `-Dhttps.protocols=TLSv1.2` because JDK7 uses `TLSv1.1` by default... also I'm not sure if you are behind a proxy/corporate network... – khmarbaise Mar 22 '21 at 10:50
  • @khmarbaise Which file has that configuration in it so I can change it? I am not in a proxy/cooperate network. – Lyra Orwell Mar 22 '21 at 10:58
  • No file you have to use that for every build via `mvn clean package -D...` ...furthermore I would recommend to use a JDK8 and just set source/target in your pom file as already being done...makes it easier... – khmarbaise Mar 22 '21 at 11:14
  • @khmarbaise I still get the same error. – Lyra Orwell Mar 22 '21 at 11:28
  • What does that mean? Using JDK8 or the JDK7 suggestion? – khmarbaise Mar 22 '21 at 11:32
  • @khmarbaise Using the -D... on JDK7. I can't go to JDK8 – Lyra Orwell Mar 22 '21 at 11:52
  • Which Maven version do you use? I don't know why you can't go to JDK8 for building and the result will be kept at 7... but that is a different story.. – khmarbaise Mar 22 '21 at 11:54
  • @khmarbaise My maven compiler is version 3.8.1 with a source and target of 1.7 – Lyra Orwell Mar 22 '21 at 13:00
  • I asked which version you are using of Maven itself ... not the maven-compiler-plugin... `mvn --version` .... – khmarbaise Mar 22 '21 at 14:07

0 Answers0