当前位置: 首页 > 知识库问答 >
问题:

Spring宠物诊所应用程序显示pom.xml错误

隗昀
2023-03-14

我已经导入了SpringPetClinic应用程序,但它在pom中显示错误。xml。我已经强制更新了Maven,但问题仍然存在。错误如下:-

未能在project spring petclinic上执行目标:无法解析项目组织的依赖项。springframework。示例:spring petclinic:jar:2.1.0。BUILD-SNAPSHOT:未能在组织上收集依赖项。springframework。boot:spring启动程序thymeleaf:jar:2.1.0。构建快照-

pom。下面给出了xml。错误显示在groupId ro下的execution标记中。isdc。wro4j。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://maven.apache.org/POM/4.0.0"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.springframework.samples</groupId>
  <artifactId>spring-petclinic</artifactId>
  <version>2.1.0.BUILD-SNAPSHOT</version>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.BUILD-SNAPSHOT</version>
  </parent>
  <name>petclinic</name>

  <properties>

    <!-- Generic properties -->
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <!-- Web dependencies -->
    <webjars-bootstrap.version>3.3.6</webjars-bootstrap.version>
    <webjars-jquery-ui.version>1.11.4</webjars-jquery-ui.version>
    <webjars-jquery.version>2.2.4</webjars-jquery.version>
    <wro4j.version>1.8.0</wro4j.version>

    <jacoco.version>0.8.2</jacoco.version>

  </properties>

  <dependencies>
    <!-- Spring and Spring Boot dependencies -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-cache</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- Databases - Uses HSQL by default -->
    <dependency>
      <groupId>org.hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <scope>runtime</scope>
    </dependency>    

    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>webjars-locator-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>jquery</artifactId>
      <version>${webjars-jquery.version}</version>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>jquery-ui</artifactId>
      <version>${webjars-jquery-ui.version}</version>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>bootstrap</artifactId>
      <version>${webjars-bootstrap.version}</version>
    </dependency>
    <!-- end of webjars -->

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <optional>true</optional>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
          <execution>
            <!-- Spring Boot Actuator displays build-related information
              if a META-INF/build-info.properties file is present -->
            <goals>
              <goal>build-info</goal>
            </goals>
            <configuration>
              <additionalProperties>
                <encoding.source>${project.build.sourceEncoding}</encoding.source>
                <encoding.reporting>${project.reporting.outputEncoding}</encoding.reporting>
                <java.source>${maven.compiler.source}</java.source>
                <java.target>${maven.compiler.target}</java.target>
              </additionalProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Spring Boot Actuator displays build-related information if a git.properties
        file is present at the classpath -->
      <plugin>
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>revision</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <verbose>true</verbose>
          <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
          <generateGitPropertiesFile>true</generateGitPropertiesFile>
          <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties
          </generateGitPropertiesFilename>
          <failOnNoGitDirectory>false</failOnNoGitDirectory>
        </configuration>
      </plugin>

      <plugin>
        <groupId>ro.isdc.wro4j</groupId>
        <artifactId>wro4j-maven-plugin</artifactId>
        <version>${wro4j.version}</version>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
          <cssDestinationFolder>${project.build.directory}/classes/static/resources/css</cssDestinationFolder>
          <wroFile>${basedir}/src/main/wro/wro.xml</wroFile>
          <extraConfigFile>${basedir}/src/main/wro/wro.properties</extraConfigFile>
          <contextFolder>${basedir}/src/main/less</contextFolder>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>${webjars-bootstrap.version}</version>
          </dependency>
          <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>spring-snapshots</id>
      <name>Spring Snapshots</name>
      <url>https://repo.spring.io/snapshot</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>spring-milestones</id>
      <name>Spring Milestones</name>
      <url>https://repo.spring.io/milestone</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>spring-snapshots</id>
      <name>Spring Snapshots</name>
      <url>https://repo.spring.io/snapshot</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
    <pluginRepository>
      <id>spring-milestones</id>
      <name>Spring Milestones</name>
      <url>https://repo.spring.io/milestone</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>    
</project>

共有3个答案

柴宏阔
2023-03-14

你使用哪个Java版本?

在Java9或更高版本上构建SpringPetClinic时,已经报告了wroj的问题https://github.com/wro4j/wro4j/pull/1041 .

这些问题在1.8.0版之后的wroj代码中得到了解决https://github.com/wro4j/wro4j,但尚未发布具有此解决方案的版本https://github.com/wro4j/wro4j/branches .

因此,您必须自己构建wroj版本1.8.1-SNAPSHOT,并使用此版本在Java 9或更高版本上构建petclinic框架版本。

拓拔意
2023-03-14

您在Spring Boot父依赖项中使用了错误的版本。您应该使用2.0.6-RELEASE或任何其他RELEASE版本。

 <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.6.RELEASE</version>
    <type>pom</type>
</dependency>

希望有帮助!

陈和裕
2023-03-14

在这种情况下,有人在PetClinic应用中面临wro4j问题。

将wro4j版本更改为1.9.0,它适用于openjdk版本“11.0.3”2019-04-16

<代码>

 类似资料:
  • 我正在尝试运行Spring Boot REST API应用程序,但遇到了404错误。 波姆。xml 我还尝试了,但没有成功。你能帮我解决这个问题吗? 如果我打http://localhost:8080/hello网址,然后我得到404。

  • spring boot web应用程序(sts-bundle)显示错误:project'demo'中所需库的归档:'c://users//.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.5.6.release/spring-boot-autoconfigure-1.5.6.release.jar'无法读取或不是

  • 我是Java的新手,我正在尝试做一个样例Spring Boot应用程序。我正在使用eclipse IDE和Java8。使用maven-archetype-quickstart原型创建了一个Maven项目。在pom.xml中 在app.java中 然后运行应用程序runas-->Maven Build Goal->Spring-boot:run 我不知道这是运行此应用程序的正确方法 我犯错了

  • 我正在尝试使用rails创建新项目,但它显示错误。我正在处理mac及其显示错误 $rails新特快专递

  • 错误如下: 02-11 13:24:31.561 526 2-5262/?E/AndroidRuntime:致命异常:main process:com.example.vicky.project,pid:5262 java.lang.runtimeException:无法启动活动ComponentInfo{com.example.vicky.project/com.example.vicky.pr

  • 我是Spring靴的初学者。我制作了简单的crud应用程序,但在编译项目时没有任何错误,但在浏览器中看不到输出。我不知道为什么。 只有这样显示才能在浏览器中看到输出。我不知道为什么。 员工控制员看起来像这样 Index.html porm.xml spring.jpa.hibernate.ddl-car=无 spring.datasource.url=jdbc:mysql://localhost: