AnsweredAssumed Answered

pom.xml CoreException and other problems

Question asked by m_scapoli on Dec 30, 2011
Latest reply on Jan 3, 2012 by m_scapoli
Salve, mi presento, sono Marco e sono uno studente che sta scrivendo la tesi di laurea sullo sviluppo di un plugin per Alfresco; spero possiate illuminarmi su questi errori perché per ora non ne sono venuto a capo..

questa la mia configurazione:
  • GNU/Linux Ubuntu 11.10 i386

  • Eclipse Java EE Development Tools and Web Development Tools Version: 3.3.1 (per avere "Web Tools Project” (WTP) e “Web Server Tools” (WST) preinstallati)

  • JDK Java version: 1.6.0_23 (uso gli openjdk: java-6-openjdk)

  • Apache-Maven (versione 2.2.1 dai repository di Ubuntu)

  • MySql_database*

  • Apache Tomcat*
(*)per quanto riguarda questi ultimi due ovvero mysql e tomcat ho resistito alla tentazione di configurarmeli da me e ho usato quelli che di default crea l'installazione dell'Alfresco Community 3.4

dopo di che ho installato tutto il necessario ovvero:
  • Alfresco Community 3.4 linux_installer (.bin)

  • Alfresco SDK (current version alfresco-community-sdk-3.4.b.zip)
infine ho studiato un po' quello che devo sviluppare e ho deciso di utilizzare gli Alfresco AMPs package con Maven e ho seguito queste guide:

http://wiki.alfresco.com/wiki/Packaging_And_Deploying_Extensions
http://wiki.alfresco.com/wiki/Managing_Alfresco_Lifecyle_with_Maven#How_to_manage_Alfresco_AMPs_.28alfresco.2Fmodule.2F.2A_based_AMP_builds.29_with_Maven

ho provato a lanciare sia l'Interactinve Project Creation command-line che l'One Liner Project Creation trovandomi meglio con quest'ultima che mi da meno errori una volta importato il progetto in Eclipse e correggendola togliendo le parti in rosso:

originale:
mvn archetype:generate -DarchetypeGroupId=com.sourcesense.alfresco -DarchetypeArtifactId=maven-alfresco-amp-archetype -DarchetypeVersion=1.9.1 -DgroupId=com.mycompany \ -DartifactId=myamp -Dversion=1.0-SNAPSHOT -DarchetypeRepository=http://maven.alfresco.com/nexus/content/repositories/releases -DinteractiveMode=false
work_for_me:
mvn archetype:generate -DarchetypeGroupId=com.sourcesense.alfresco -DarchetypeArtifactId=maven-alfresco-amp-archetype -DarchetypeVersion=1.9.1 -DgroupId=com.mycompany \-DartifactId=myamp -Dversion=1.0 -DarchetypeRepository=http://maven.alfresco.com/nexus/content -DinteractiveMode=false

dopo aver importato il tutto in Eclipse ho corretto a mano il pom.xml come dice qui:

http://maven.alfresco.com/nexus/content/repositories/alfresco-docs/maven-alfresco-lifecycle/plugins/maven-amp-plugin/index.html

sostituendo tutti le <version>3.0.1–SNAPSHOT</version> che ho trovato con <version>3.0.2</version> risolvendo ulteriori errori in compilazione..

ora mi trovo con degli errori che non riesco davvero a maneggiare e non so proprio dove sbattere la testa, ovvero:

  1. Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile)

  2. Plugin execution not covered by lifecycle configuration: com.sourcesense.maven:maven-nosnapshot-plugin:0.0.5-SNAPSHOT:strip (execution: default, phase: initialize)

  3. Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile)

  4. CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 (): ArtifactDescriptorException: Failed to read artifact descriptor for org.codehaus.plexus:plexus-compiler-javac:jar:1.8.1: UnresolvableModelException: Failure to transfer org.codehaus.plexus:plexus-compilers:pom:1.8.1 from http://maven.alfresco.com/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of alfresco-public has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-compilers:pom:1.8.1 from/to alfresco-public (http://maven.alfresco.com/nexus/content/groups/public): The operation was cancelled.

  5. CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 (): ArtifactDescriptorException: Failed to read artifact descriptor for org.codehaus.plexus:plexus-compiler-javac:jar:1.8.1: UnresolvableModelException: Failure to transfer org.codehaus.plexus:plexus-compilers:pom:1.8.1 from http://maven.alfresco.com/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of alfresco-public has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-compilers:pom:1.8.1 from/to alfresco-public (http://maven.alfresco.com/nexus/content/groups/public): The operation was cancelled.
in realtà il 2. l'ho eliminato commentando semplicemente questa parte del pom.xml
            <!–
               <execution>
                  <id>default</id>
                  <phase>initialize</phase>
                  <goals>
                     <goal>strip</goal>
                  </goals>
               </execution>
            –>
invece tutto ciò che riguarda il maven-compiler-plugin continua a non funzionare e a darmi errore.

posto anche il mio pom.xml se può essere di aiuto…
<?xml version="1.0" encoding="UTF-8"?>
   <!–
      Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements. See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version
      2.0 (the "License"); you may not use this file except in compliance
      with the License. You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0 Unless required by
      applicable law or agreed to in writing, software distributed under the
      License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
      CONDITIONS OF ANY KIND, either express or implied. See the License for
      the specific language governing permissions and limitations under the
      License.
   –>
<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>com.mycompany</groupId>
   <artifactId>myamp</artifactId>
   <packaging>amp</packaging>
   <name>Maven Alfresco AMP Packaging Sample</name>
   <!–
      An Alfresco version number must be of the form 1.2.3.4. Using
      1.0-SNAPSHOT as the AMP version will create an exception. See
      http://wiki.alfresco.com/wiki/Developing_an_Alfresco_Module: "The
      version number must be made up of numeric values separated by dots.
      For example '2.1.56' is a valid version number, '2.3.4a' is not. " In
      order to be able to use Maven snapshots we cannot use the <version/>
      below as the AMP module version. Instead we use the
      buildnumber-maven-plugin. This requires a scm connection.
   –>
   <version>1.0</version>
   <description>Test AMP project</description>
   <repositories>
      <repository>
         <id>alfresco-public-snapshots</id>
      <url>http://maven.alfresco.com/nexus/content/groups/public-snapshots</url>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
      </repository>
      <repository>
         <id>alfresco-public</id>
      <url>http://maven.alfresco.com/nexus/content/groups/public</url>
      </repository>
   </repositories>
   <pluginRepositories>
      <pluginRepository>
         <id>alfresco-public</id>
      <url>http://maven.alfresco.com/nexus/content/groups/public</url>
      </pluginRepository>
      <pluginRepository>
         <id>alfresco-public-snapshots</id>
         <url>http://repository.sourcesense.com/nexus/content/groups/public-snapshots</url>
         <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
      </pluginRepository>
   </pluginRepositories>
   <properties>
      <!–
         Default for which src/main/properties/<env>/application.properties is
         loaded. NB: used only for the 'test' profile (e.g. '-P test' on the
         mvn commandline) jetty run deployment, does not impact AMP behavior
         which is typically environment independent
      –>
      <env>local</env>
      <!– Webapp used to test/develop locally the AMP –>
      <webapp.name>myamp-webapp</webapp.name>
      <!–
         | | By default the src/test/properties/local/application.properties
         uses the property "alfresco.data.location" to specify where |
         alf_data gets created. | For local jetty:run deployment default
         creation dir is under project root folder (as location is specified
         relatively to run | dir). Please add alf_data_jetty in svn/cvs
         ignores in order not to commit that. You can also specified a
         different (out of the | sproject) folder | by editing the following
         properties. | DB is also configurable here. Of course keep in sync
         these two values otherwise you'll get integrity errors. | | Empty log
         dir creates file alfresco.log in appserver default dir. You can also
         specify a meaningful log directory for the server | (add a trailing
         slash, e.g. '/var/log/alfresco/' ) | | Jetty embedded run logs by
         default in target/alfresco.log
      –>
      <alfresco.data.location>./alf_data_jetty</alfresco.data.location>
      <alfresco.db.name>alf_jetty</alfresco.db.name>
      <alfresco.db.username>alfresco</alfresco.db.username>
      <alfresco.db.password>alfresco</alfresco.db.password>
      <webapp.log.level>error</webapp.log.level>
      <webapp.log.dir></webapp.log.dir>
      <!–  End of testing webapp specific properties –>
      <!–  Module specific build time properties –>
      <module.log.level>debug</module.log.level>
   </properties>
   <!–
      need to list these as a provided so that Maven doesn't download them
      and include them in the AMP, they are provided by Alfresco
   –>
   <dependencies>
      <dependency>
         <groupId>org.alfresco</groupId>
         <artifactId>alfresco-repository</artifactId>
         <version>3.2r</version>
         <scope>provided</scope>
         <classifier>community</classifier>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring</artifactId>
         <version>2.0</version>
         <scope>provided</scope>
      </dependency>
      <!–
         Example Jar dependency: will be properly packed into the AMP /lib
         directory <dependency> <groupId>rome</groupId>
         <artifactId>opensearch</artifactId> <version>0.1</version>
         </dependency>
      –>
      <!–
         Example AMP dependency: will be properly overlayed in the WAR
         produced by the integration-test phase in profile 'webapp'
         <dependency> <groupId>org.alfresco</groupId>
         <artifactId>recordsmanagement</artifactId> <version>2.1.0</version>
         <type>amp</type> </dependency>
      –>
      <!–
         By default archetype assumes mysql for test webapp. Change
         src/test/properties/<env>/application.properties FIXME: support in
         memory db for cleaner and safer test runs
      –>
      <dependency>
         <groupId>mysql</groupId>
         <artifactId>mysql-connector-java</artifactId>
         <version>5.0.3</version>
      </dependency>
      <!– Don't add here amp dependencies as it will break amp packaging –>
   </dependencies>
   <!–
      The scm is required for the buildnumber-maven-plugin which is required
      for AMP version numbering
   –>
   <scm>
      <connection>scm:svn:http://domain.com/svn/trunk/</connection>
      <developerConnection>scm:svn:https://${maven.username}@domain.com/svn/trunk/</developerConnection>
      <url>http://domain.com/svn/trunk/</url>
   </scm>
   <build>
      <plugins>
         <plugin>
            <artifactId>maven-nosnapshot-plugin</artifactId>
            <groupId>com.sourcesense.maven</groupId>
             <version>0.0.5</version>
            <executions>
            <!–
               <execution>
                  <id>default</id>
                  <phase>initialize</phase>
                  <goals>
                     <goal>strip</goal>
                  </goals>
               </execution>
            –>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>buildnumber-maven-plugin</artifactId>
            <version>1.0-beta-2</version>
            <executions>
               <execution>
                  <phase>validate</phase>
                  <goals>
                     <goal>create</goal>
                  </goals>
               </execution>
            </executions>
            <configuration>
               <revisionOnScmFailure>1</revisionOnScmFailure>
               <doCheck>false</doCheck>
               <doUpdate>false</doUpdate>
            </configuration>
         </plugin>
         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
               <source>1.6</source>
               <target>1.6</target>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.alfresco.maven.plugin</groupId>
            <artifactId>maven-amp-plugin</artifactId>
            <version>3.0.2</version>
            <!– Used to have AMP lifecycle available –>
            <extensions>true</extensions>
            <configuration>
               <archive>
                  <addMavenDescriptor>false</addMavenDescriptor>
               </archive>
               <overlays>
                  <!–
                     This sample adds records management module in the finally built
                     AMP <overlay> <groupId>org.org.alfresco</groupId>
                     <artifactId>recordsmanagement</artifactId>
                     <version>2.1.0</version> <type>amp</type> </overlay>
                  –>
                  <!–
                     The current AMP is always last in order to overwrite other
                     modules' modules.properties <overlay></overlay>
                  –>
               </overlays>
            </configuration>
         </plugin>
      </plugins>
      <!–
         Copies and filters resources in build folder so maven-amp-plugin can
         pick them up
      –>
      <resources>
         <resource>
            <filtering>true</filtering>
            <directory>src/main/resources</directory>
            <excludes>
               <exclude>**README-*</exclude>
            </excludes>
         </resource>
         <!–
            Copies and filters AMP config in the proper package
            'alfresco/module/com.mycompany.myamp' so to enforce full module
            naming single sourcing from POM properties
         –>
         <resource>
            <filtering>true</filtering>
            <directory>src/main/config</directory>
            <targetPath>alfresco/module/com.mycompany.myamp</targetPath>
            <excludes>
               <exclude>**README-*</exclude>
            </excludes>
         </resource>
      </resources>
   </build>
   <profiles>
      <!–
         Profile used to trigger war creation and integration within Jetty
         embedded
      –>
      <profile>
         <id>webapp</id>
         <build>
            <filters>
               <filter>src/test/properties/${env}/application.properties</filter>
            </filters>
            <defaultGoal>jetty:run-exploded</defaultGoal>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-dependency-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>unpack-amps</id>
                        <phase>process-resources</phase>
                        <goals>
                           <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                           <includeTypes>amp</includeTypes>
                           <outputDirectory>${build.directory}/${webapp.name}</outputDirectory>
                           <excludes>META*</excludes>
                        </configuration>
                     </execution>
                  </executions>
                  <dependencies>
                     <!–
                        This is required to be re-defined explicitly at plugin level as
                        otherwise the 'amp' extension unArchiver won't be available to
                        the maven-dependency-plugin
                     –>
                     <dependency>
                        <groupId>org.alfresco.maven.plugin</groupId>
                        <artifactId>maven-amp-plugin</artifactId>
                        <version>3.0.2</version>
                        <!– Used to have AMP lifecycle available –>
                     </dependency>
                     <dependency>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>2.3.2</version>
                     </dependency>
                  </dependencies>
               </plugin>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-war-plugin</artifactId>
                  <executions>
                     <!– Runs war packaging when 'integration-test' phase is called –>
                     <execution>
                        <id>it</id>
                        <phase>package</phase>
                        <goals>
                           <goal>exploded</goal>
                        </goals>
                        <configuration>
                           <archiveClasses>true</archiveClasses>
                        </configuration>
                     </execution>
                  </executions>
                  <configuration>
                     <primaryArtifact>false</primaryArtifact>
                     <!–
                        Don't remove the following line otherwise WAR and AMP builds
                        will be done in the same folder, with unexpected results
                     –>
                     <webappDirectory>${build.directory}/${webapp.name}</webappDirectory>
                     <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                     </archive>
                     <warSourceExcludes>licenses/**</warSourceExcludes>
                     <webResources></webResources>
                     <webResources>
                        <resource>
                           <directory>${build.testOutputDirectory}</directory>
                           <targetPath>WEB-INF/classes</targetPath>
                           <filtering>true</filtering>
                           <includes>
                              <include>**</include>
                           </includes>
                        </resource>
                        <!– Here we add default this AMP web/ resources–>
                        <resource>
                           <directory>src/main/webapp</directory>
                           <targetPath>WEB-INF/licenses</targetPath>
                           <includes>
                              <include>licenses/*.*</include>
                           </includes>
                           <filtering>false</filtering>
                        </resource>
                     </webResources>
                  </configuration>
                  <dependencies>
                     <!–
                        This is required to be re-defined explicitly at plugin level as
                        otherwise the 'amp' extension unArchiver won't be available to
                        the maven-war-plugin
                     –>
                     <dependency>
                        <groupId>org.alfresco.maven.plugin</groupId>
                        <artifactId>maven-amp-plugin</artifactId>
                        <version>3.0.2</version>
                        <!– to have AMP lifecycle updated –>
                     </dependency>
                  </dependencies>
               </plugin>
               <plugin>
                  <groupId>org.mortbay.jetty</groupId>
                  <artifactId>maven-jetty-plugin</artifactId>
                  <executions>
                     <!– Runs jetty when 'integration-test' phase is called –>
                     <execution>
                        <id>it</id>
                        <phase>integration-test</phase>
                        <goals>
                           <goal>run-exploded</goal>
                        </goals>
                        <configuration>
                           <contextPath>/${webapp.name}</contextPath>
                           <webApp>${pom.build.directory}/${webapp.name}</webApp>
                           <scanIntervalSeconds>10</scanIntervalSeconds>
                           <connectors>
                              <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                                 <port>8080</port>
                                 <maxIdleTime>60000</maxIdleTime>
                              </connector>
                           </connectors>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
            <!–
               When invoking 'mvn integration-test', the following alf configs are
               added to the test war in order to be able to run it seamlessly. NB:
               the application.properties file is filtered with alfresco.db.name
               and alf.data.location POM properties as default configuration
            –>
            <testResources>
               <testResource>
                  <filtering>true</filtering>
                  <directory>src/test/resources</directory>
               </testResource>
               <!– Includes default properties  for alfresco test war –>
               <testResource>
                  <filtering>true</filtering>
                  <directory>src/test/properties/${env}</directory>
                  <targetPath>alfresco/extension</targetPath>
               </testResource>
               <!–
                  src/main/config/ is copied into ==>
                  target/test-classes/alfresco/module/com.mycompany.myamp to be
                  picked up by the maven-war plugin Best practice tacken from
                  recordsmanagement.amp, is enforced troughout the whole archetype.
                  This convention is also used for module.properties filtering.
               –>
               <testResource>
                  <filtering>true</filtering>
                  <directory>.</directory>
                  <includes>
                     <include>module.properties</include>
                  </includes>
                  <targetPath>alfresco/module/com.mycompany.myamp</targetPath>
               </testResource>
            </testResources>
         </build>
         <!–
            Here you can add test dependencies you want to have included in the
            the WAR (not in the AMP, built in the main profile) | | Typical use
            case: add here additional AMPs that you want to test compatibility
            of with the current module |
         –>
         <dependencies>
            <!–
               This is the alfresco version you're testing the AMP against. Don't
               remove if you want jetty to be able to deploy a WAR :)
            –>
            <dependency>
               <groupId>org.alfresco</groupId>
               <artifactId>alfresco</artifactId>
               <version>3.2r</version>
               <type>war</type>
               <classifier>community</classifier>
            </dependency>
         </dependencies>
      </profile>

   </profiles>
</project>
Grazie in anticipo della pazienza e delle risposte, intanto continuerò a provare.  :)

Regards

Outcomes