cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to build project with maven on MacOS 10.8

logxjb
Champ in-the-making
Champ in-the-making
Hello,

While writing the case, I ultimately tested something which solved my problem …

I had to run "mvn install" as root user with "sudo" and everything worked fine.

I still put the message on this forum if someone run in the same problems

Regards,
Jérémy

————–
Original problem:

I've followed this tutorial: http://ecmarchitect.com/alfresco-developer-series-tutorials/maven-sdk/tutorial/tutorial.html

I'm running MacOS X 10.8.5

I've installed the JDK 1.7 from Oracle (Java version: 1.7.0_51, vendor: Oracle Corporation)

For maven, I've installed it from Homebrew (Apache Maven 3.2.1)

I edited my $HOME/.mavenrc to ensure that it take the 1.7 JDK in account:

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home



Everything gone well until I've gone to the "Let's run it" chapter

I've tried "mvn install" from the project directory.

First got this:


[ERROR]  
[ERROR]   The project ch.projectname:content-tutorial-repo:1.0-SNAPSHOT (/project/path/content-tutorial-repo/pom.xml) has 2 errors
[ERROR]     Unresolveable build extension: Plugin org.alfresco.maven.plugin:alfresco-maven-plugin:1.1.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.alfresco.maven.plugin:alfresco-maven-plugin:jar:1.1.1: Could not find artifact org.alfresco.maven:alfresco-lifecycle-aggregator:pom:1.1.1 in alfresco-plugin-public-snapshots (https://artifacts.alfresco.com/nexus/content/groups/public-snapshots) -> [Help 2]
[ERROR]     Unknown packaging: amp @ line 9, column 16


However, since it was downloading some stuff and the server may have a timeout or anything, I've tried to run a new time the "mvn install" command.

Then, I've gone a new error from Unit Test:


Running org.alfresco.demoamp.test.DemoComponentTest
2014-03-25 02:03:49,133  WARN  [alfresco.util.RuntimeSystemPropertiesSetter] [main] Could not find alfresco-jmxrmi.password on classpath
2014-03-25 02:03:50,078  INFO  [alfresco.repo.admin] [main] Using database URL 'jdbc:h2:./alf_data_dev/h2_data/alf_dev;MODE=PostgreSQL;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;MVCC=TRUE' with user 'alfresco'.
2014-03-25 02:03:50,540  ERROR [test.context.TestContextManager] [main] Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@73778636] to prepare test instance [org.alfresco.demoamp.test.DemoComponentTest@2c0c7e73]
java.lang.IllegalStateException: Failed to load ApplicationContext


This is the top of the stacktrace, I have kilometers of stacktrace behind this one I could give if needed to help me.
5 REPLIES 5

logxjb
Champ in-the-making
Champ in-the-making
The solution with "sudo" don't work anymore Smiley Sad

Any help would be appreciated.

jpotts
World-Class Innovator
World-Class Innovator
Please post your pom.xml.

Jeff

logxjb
Champ in-the-making
Champ in-the-making
Hello,

This is the content of my pom.xml.

I didn't modified it from the base pom.xml, but Eclipse did something.

Regards,
Jérémy

<blockcode>
<?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>com.myproject</groupId>
    <artifactId>myproject-repo</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>myproject-repo AMP project</name>
    <packaging>amp</packaging>
    <description>Manages the lifecycle of the myproject-repo AMP (Alfresco Module Package)</description>

    <parent>
        <groupId>org.alfresco.maven</groupId>
        <artifactId>alfresco-sdk-parent</artifactId>
        <version>1.1.1</version>
    </parent>

    <!–
       | SDK properties have sensible defaults in the SDK parent,
       | but you can override the properties below to use another version.
       | For more available properties see the alfresco-sdk-parent POM.
       –>
    <properties>
        <!– Defines the alfresco edition to compile against. Allowed values are [org.alfresco|org.alfresco.enterprise]–>
        <alfresco.groupId>org.alfresco</alfresco.groupId>
        <!– Defines the alfresco version to compile against –>
        <alfresco.version>4.2.e</alfresco.version>
        <app.log.root.level>WARN</app.log.root.level>
        <alfresco.data.location>alf_data_dev</alfresco.data.location>
        <!– Defines the target WAR artifactId to run this amp, only used with the -Pamp-to-war switch
        .    | Allowed values: alfresco | share. Defaults to a repository AMP, but could point to your foundation WAR –>
        <alfresco.client.war>alfresco</alfresco.client.war>
        <!– Defines the target WAR groupId to run this amp, only used with the -Pamp-to-war switch
        .    | Could be org.alfresco | org.alfresco.enterprise or your corporate groupId –>
        <alfresco.client.war.groupId>org.alfresco</alfresco.client.war.groupId>
        <!– Defines the target WAR version to run this amp, only used with the -Pamp-to-war switch –>
        <alfresco.client.war.version>4.2.e</alfresco.client.war.version>
        <!– This controls which properties will be picked in src/test/properties for embedded run –>
        <env>local</env>
    </properties>

    <!– Here we realize the connection with the Alfresco selected platform
        (e.g.version and edition) –>
    <dependencyManagement>
        <dependencies>
            <!– This will import the dependencyManagement for all artifacts in the selected Alfresco version/edition
                (see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Depe...)
                NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement. NOTE: It defaults
                to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom –>
            <dependency>
                <groupId>${alfresco.groupId}</groupId>
                <artifactId>alfresco-platform-distribution</artifactId>
                <version>${alfresco.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <!– Following dependencies are needed for compiling Java code in src/main/java;
         <scope>provided</scope> is inherited for each of the following;
         for more info, please refer to alfresco-platform-distribution POM –>
    <dependencies>
        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>alfresco-repository</artifactId>
        </dependency>
        <!– Test dependencies –>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!– This repository is only needed to retrieve Alfresco parent POM.
        NOTE: This can be removed when/if Alfresco will be on Maven Central
       
        NOTE: The repository to be used for Alfresco Enterprise artifacts is
        https://artifacts.alfresco.com/nexus/content/groups/private/. Please check
        with Alfresco Support to get credentials to add to your ~/.m2/settings.xml
        if you are a Enterprise customer or Partner 
        –>
    <repositories>
        <repository>
            <id>alfresco-public</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
        </repository>
        <repository>
            <id>alfresco-public-snapshots</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </snapshots>
        </repository>
    </repositories>
    <build>
       <pluginManagement>
          <plugins>
             <!–This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.–>
             <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                   <lifecycleMappingMetadata>
                      <pluginExecutions>
                         <pluginExecution>
                            <pluginExecutionFilter>
                               <groupId>
                                  org.alfresco.maven.plugin
                               </groupId>
                               <artifactId>
                                  alfresco-maven-plugin
                               </artifactId>
                               <versionRange>
                                  [1.1.1,)
                               </versionRange>
                               <goals>
                                  <goal>set-version</goal>
                               </goals>
                            </pluginExecutionFilter>
                            <action>
                               <ignore></ignore>
                            </action>
                         </pluginExecution>
                      </pluginExecutions>
                   </lifecycleMappingMetadata>
                </configuration>
             </plugin>
          </plugins>
       </pluginManagement>
    </build>
</project>
</blockcode>

jpotts
World-Class Innovator
World-Class Innovator
Your pom looks fine.

I am concerned about the fact that you had to run with sudo. Can you check the permissions of your root project directory? That directory and all of its children should be owned by you. If any are not owned by you, use chown to fix, like this: chown -R jpotts *

Jeff

logxjb
Champ in-the-making
Champ in-the-making
Hello,

Finally the problem is solved, thanks to you and IRC discussion.

I was in a case where my computer had a hostname set by my company sysadmin like "myname.company.com"

For an unknown reason, Maven was trying to launch Postgres or Tomcat using that hostname instead of using "localhost" or "127.0.0.1" … So, when I was at my company, everything worked fine since the internal DNS server was able to solve the hostname, but when I was at home … shit happened.

The only way I could solve this has been to issue a "sudo hostname myname.local" to temporary return to the Bonjour hostname.

Regards,
Jérémy