Java Can';t使用Spring Boot构建Maven项目

Java Can';t使用Spring Boot构建Maven项目,java,maven,spring-boot,Java,Maven,Spring Boot,我试图构建Maven示例Spring Boot项目。我从中生成了SpringBoot项目。我做了Maven更新。当我在Spring工具套件IDE中使用mvn clean install命令运行pom.xml时,我得到以下错误 错误 下面是我的pom.xml和Settings.xml Pom.xml 4.0.0 org.springframework.boot spring启动程序父级 2.1.2.1发布 com.luv2code.springboot.demo 麦考拉普 0.0.1-快照 麦考

我试图构建Maven示例Spring Boot项目。我从中生成了SpringBoot项目。我做了Maven更新。当我在Spring工具套件IDE中使用
mvn clean install
命令运行
pom.xml
时,我得到以下错误

错误 下面是我的pom.xml和Settings.xml Pom.xml

4.0.0
org.springframework.boot
spring启动程序父级
2.1.2.1发布
com.luv2code.springboot.demo
麦考拉普
0.0.1-快照
麦考拉普
SpringBoot的演示项目
1.8
org.springframework.boot
弹簧靴起动器执行器
org.springframework.boot
spring引导启动器数据jpa
org.springframework.boot
弹簧启动安全
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧靴开发工具
运行时
org.springframework.boot
弹簧起动试验
测验
org.springframework.security
弹簧安全性试验
测验
org.springframework.boot
springbootmaven插件

Settings.xml

C:/Users/nicolas/Dev/repo
安全中心
符合事实的
中心的
https://repo1.maven.org/maven2
符合事实的
中心的
https://repo1.maven.org/maven2
符合事实的

我能够使用您的
pom.xml
构建项目,请尝试使用以下配置:

<settings>
  ...

  <profiles>
    <profile>
      <id>central</id>
      <repositories>
        <repository>
          <id>central</id>
          <name>central</name>
          <url> http://central.maven.org/maven2/</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>central</activeProfile>
  </activeProfiles>

  ...
</settings>
<proxies>
  <proxy>
    <active>true</active>
    <protocol>http</protocol>
    <host>mywonderfulproxy.com</host>
    <port>8080</port>
  </proxy>
</proxies>

...
中心的
中心的
中心的
http://central.maven.org/maven2/
违约
总是
中心的
...
正如@BreakingBenjamin所指出的,用代理配置补充设置:

<settings>
  ...

  <profiles>
    <profile>
      <id>central</id>
      <repositories>
        <repository>
          <id>central</id>
          <name>central</name>
          <url> http://central.maven.org/maven2/</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>central</activeProfile>
  </activeProfiles>

  ...
</settings>
<proxies>
  <proxy>
    <active>true</active>
    <protocol>http</protocol>
    <host>mywonderfulproxy.com</host>
    <port>8080</port>
  </proxy>
</proxies>

符合事实的
http
mywonderfulproxy.com
8080

如果您已经这样做了,请使用更新的
settings.xml

补充您的答案。我通过在settings.xml中添加下面的代理成功构建了应用程序

  <proxies>
   <proxy>
    <id>example-proxy</id>
    <active>true</active>
    <protocol>http</protocol>
    <host>proxy.example.com</host>
    <port>8080</port>
    <username>proxyuser</username>
    <password>somepassword</password>
    <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
   </proxy>
 </proxies>

示例代理
符合事实的
http
proxy.example.com
8080
代理用户
密码
www.google.com |*.example.com

@BreakingBenjamin我用代理更新了设置xml,但我仍然面临同样的问题。除了我在最后添加的缺少项目结束标记之外,您的pom对我有效。但我使用的是Maven Central的存储库url。嗯,奇怪的是,我假设与我的settings.xml配置有关,但不确定具体是什么。问题在于:
(https://repo1.maven.org/maven2):连接超时并且…
意味着网络/代理问题。。。
  <proxies>
   <proxy>
    <id>example-proxy</id>
    <active>true</active>
    <protocol>http</protocol>
    <host>proxy.example.com</host>
    <port>8080</port>
    <username>proxyuser</username>
    <password>somepassword</password>
    <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
   </proxy>
 </proxies>