0

I'm studying "Cloud-Native Applications in Java" and I'm doing the exercise in this book. This is my pom.xml:

<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>
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.3.RELEASE</version>
  </parent>
  <groupId>com.mycompany.petstore</groupId>
  <artifactId>product</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  <dependencies>                    
    <dependency>                                    
    <groupId>org.springframework.boot</groupId>                                 
     <artifactId>spring-boot-starter-web</artifactId>           
        </dependency>
  </dependencies>   
  <build>

    <plugins>

        <plugin>                                                    
            <groupId>org.springframework.boot</groupId>                                                 
            <artifactId>spring-boot-maven-plugin</artifactId>   
        </plugin>
    </plugins>

  </build>
</project>

I set up the settings of Maven on a specific path: C:\Users\Sam.m2\settings.xml

The only information that I set up on my settings.xml is the following:

...
  <proxies>             
    <proxy>                     
        <id>myproxy</id>                        
        <active>true</active>                           
        <protocol>http</protocol>                           
        <host>localhost:8080</host> 
        <nonProxyHosts>localhost,127.0.0.1</nonProxyHosts>      
        <port>8080</port>                                                                           
    </proxy>    
  </proxies>

When I try to run this program (a simple program with three java classes), in my console there is:

 --- maven-surefire-plugin:2.18.1:test (default-test) @ product ---
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.18.1/maven-surefire-common-2.18.1.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.18.1/surefire-api-2.18.1.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.3/maven-plugin-annotations-3.3.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.873 s
[INFO] Finished at: 2019-07-21T15:32:13+02:00
[INFO] Final Memory: 18M/224M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project product: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.18.1 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-plugin:jar:2.18.1 -> org.apache.maven.surefire:maven-surefire-common:jar:2.18.1: Failed to read artifact descriptor for org.apache.maven.surefire:maven-surefire-common:jar:2.18.1: Could not transfer artifact org.apache.maven.surefire:maven-surefire-common:pom:2.18.1 from/to central (https://repo.maven.apache.org/maven2): localhost:8080 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

How can I solve the problem?

Sam
  • 536
  • 5
  • 23

0 Answers0