Maven 错误 - Spring Surf Alfresco

Maven error - Spring Surf Alfresco

要构建项目 Spring 在 Alfresco 上冲浪,我使用了命令:

mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/archetype-catalog.xml

我给了groupId=surfcmistestartifactId=surfcmistest-1.0-SNAPSHOT。然后,在项目创建的文件夹 surfcmistest-1.0-SNAPSHOT 上,我尝试使用 Maven 进行构建和打包。我运行:

mvn install

我得到错误:

Failed to execute goal on project surfcmistest-1.0-SNAPSHOT: Could not resolve dependencies for project surfcmistest:surfcmistest-1.0-SNAPSHOT:war:1.0-SNAPSHOT: Failed to collect dependencies at org.springframework.extensions.surf:spring-surf:jar:5.1-BF-SNAPSHOT: Failed to read artifact descriptor for org.springframework.extensions.surf:spring-surf:jar:5.1-BF-SNAPSHOT: Failure to find org.alfresco:alfresco-parent:pom:5.1-BF-SNAPSHOT in https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of Alfresco-Artifacts has elapsed or updates are forced -> [Help 1]

我的pom.xml是:

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>surfcmistest</groupId>
  <artifactId>surfcmistest-1.0-SNAPSHOT</artifactId>
  <packaging>war</packaging>
  <name>sample-app Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <repositories>
    <repository>
      <id>Alfresco-Artifacts</id>
      <name>Alfresco Artifacts SNAPSHOTS</name>
      <url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/</url>
    </repository>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
       <groupId>org.springframework.extensions.surf</groupId>
       <artifactId>spring-surf</artifactId>
       <version>5.1-BF-SNAPSHOT</version>
    </dependency>
    <dependency>
       <groupId>org.springframework.extensions.surf</groupId>
       <artifactId>spring-surf-api</artifactId>
       <version>5.1-BF-SNAPSHOT</version>
    </dependency>
    <dependency>
         <groupId>org.tuckey</groupId>
         <artifactId>urlrewritefilter</artifactId>
         <version>4.0.4</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
       <plugin>
          <groupId>org.eclipse.jetty</groupId>
          <artifactId>jetty-maven-plugin</artifactId>
          <version>9.2.2.v20140723</version>
          <configuration>
             <scanIntervalSeconds>0</scanIntervalSeconds>
             <scanTargets>
                <scanTarget>src/main/webapp</scanTarget>
             </scanTargets>
          </configuration>
       </plugin>
    </plugins>
  </build>
  <version>1.0-SNAPSHOT</version>
</project>

我的错误是什么?

您收到的错误消息是:

resolution will not be reattempted until the update interval of Alfresco-Artifacts has elapsed or updates are forced

这是一个非常典型的错误,运行ning Maven 使用 -U 选项解决了它。

您应该从头开始并按照以下步骤操作:

  • 删除整个 m2 存储库(默认位置为 ~/.m2/repository)并删除之前执行 maven-archetype-plugin.
  • 创建的任何目录
  • 运行命令:

    mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/archetype-catalog.xml
    
    • 选择选项 org.springframework.extensions.surf:spring-surf-archetype(对我来说,它是选项 1,但它可以更改)。
    • 选择版本 5.1-SNAPSHOT,这对我来说是选项 4(但同样,这可以更改)
    • Select groupId、artifactId、版本、包并按 Y.
    • 确认所有这些属性
  • 进入新创建的目录(它将以您之前选择的 artifactId 命名)并运行以下 Maven 命令:

    mvn -U clean install