2
votes

To construct a project Spring Surf on Alfresco, I used the command:

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

I gave groupId=surfcmistest and artifactId=surfcmistest-1.0-SNAPSHOT. Then, on the folder surfcmistest-1.0-SNAPSHOT created by the project, I try to make build and package with Maven. I run:

mvn install

and I obtain the error:

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]

My pom.xml is:

<?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>

What is my error?

1
what maven SDK version are you using? the pom you attached doesn't show it. as it states here: docs.alfresco.com/5.0/tasks/… you seem to be using an old on, mvn archetype:generate -Dfilter=org.alfresco.maven.archetype:alfresco-amp-archetype here you'll find the catalog is no longer necessary, in your mvn command.Teqnology
what I menat was: Alfresco Maven SDK, there is no sign of the version in your pom, you should have something like <parent> ... <artifactId>alfresco-sdk-parent ... <version>2.1.0 ... It looks to me you're using an old one, and you're not following the latest directives as in the link I pasted there (no need to specify a catalog for instance)Teqnology
How can i see the version? But without the catalog i cannot find the spring-surfPRVS
I put the parent but not solved it.PRVS

1 Answers

3
votes

The error message you are getting is:

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

This is a very classic error and it is resolved by running Maven with the -U option.

You should restart from scratch and follow this procedure:

  • Remove your whole m2 repository (the default location is ~/.m2/repository) and remove any directory created by an earlier execution of the maven-archetype-plugin.
  • Run the command:

    mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/archetype-catalog.xml
    
    • Choose the option org.springframework.extensions.surf:spring-surf-archetype (for me, it was option 1 but it can change).
    • Choose the version 5.1-SNAPSHOT, which was option 4 for me (but again, this can change)
    • Select a groupId, an artifactId, a version, a package and confirm all those properties by pressing Y.
  • Go into the newly created directory (it will be named after the artifactId you chose earlier) and run the following Maven command:

    mvn -U clean install