Невозможно добавить работу Springframe в проекте Maven - PullRequest
0 голосов
/ 05 октября 2018

Я пытаюсь добавить spring-core и spring-context в проект maven, но при сборке я получаю следующую ошибку, я пытаюсь получить доступ к трем репозиториям, которые указаны в первых 3 строках следующей ошибки компиляции:

[INFO] Downloading from : http://repo1.maven.org/maven2/org/springframework/spring-context/4.0.0.RELEASE/spring-context-4.0.0.RELEASE.pom
[INFO] Downloading from : https://repo.spring.io/milestone/org/springframework/spring-context/4.0.0.RELEASE/spring-context-4.0.0.RELEASE.pom
[INFO] Downloading from : https://repo.maven.apache.org/maven2/org/springframework/spring-context/4.0.0.RELEASE/spring-context-4.0.0.RELEASE.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.622 s
[INFO] Finished at: 2018-10-05T18:18:19+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project HelloWorldMaven: Could not resolve dependencies for project Demo:HelloWorldMaven:jar:0.1: Failed to collect dependencies at org.springframework:spring-context:jar:4.0.0.RELEASE: Failed to read artifact descriptor for org.springframework:spring-context:jar:4.0.0.RELEASE: Could not transfer artifact org.springframework:spring-context:pom:4.0.0.RELEASE from/to central (http://repo1.maven.org/maven2): connect timed out -> [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:

Ниже приведен мой файл 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>
      <groupId>Demo</groupId>
      <artifactId>HelloWorldMaven</artifactId>
      <version>0.1</version>
      <name>Hello world demo</name>
      <description>Hello world demo</description>

      <properties>
        <org.springframework-core-version>4.0.0.RELEASE</org.springframework-core-version> 
        <org.springframework-context-version>4.0.0.RELEASE</org.springframework-context-version>
        <log4j-version>1.2.17</log4j-version>
        <junit-version>4.12</junit-version>
    </properties>

      <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j-version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${org.springframework-core-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-context-version}</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit-version}</version>
        </dependency>       
      </dependencies>

      <build>
      <plugins>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <configuration>
            <archive>
              <manifest>
                <mainClass>fully.qualified.MainClass</mainClass>
              </manifest>
            </archive>
            <descriptorRefs>
              <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
          </configuration>
        </plugin>
      </plugins>
    </build>


    </project>

Пожалуйста, помогите, я не могу понять, что мне не хватает, я думаю, что яне может получить доступ к удаленным репозиториям.Пожалуйста помоги.Заранее спасибо.

Ответы [ 2 ]

0 голосов
/ 08 октября 2018

Я добавил следующее в свой setting.xml

    <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>my.host.address</host>
      <port>myPort</port>
    </proxy>
  </proxies>

и запустил проект с

чистой установкой -DproxySet = true -DproxyHost = my.host.address -DproxyPort = myPort

И это сработало!

0 голосов
/ 05 октября 2018

Вы, вероятно, находитесь за прокси-сервером, или ваша текущая сеть требует прокси-сервера, или ваше соединение нестабильно

to central (http://repo1.maven.org/maven2): connect timed out ->

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...