6 Replies Latest reply on Aug 26, 2012 5:40 PM by bwallis42

    Building 3.0-SNAPSHOT on Mac OSX

    bwallis42

      I have a mac running snow leopard (10.6.8) with the latest apple version of JDK6 install (1.6.0_33) and maven version 3.0.3.

       

      I have just checked out the latest on the master branch of modeshape to do a build but the build fails with a maven error about not have JDK6.

       

      {noformat}

      [DEBUG] Configuring mojo org.apache.maven.plugins:maven-enforcer-plugin:1.0:enforce from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-enforcer-plugin:1.0, parent: sun.misc.Launcher$AppClassLoader@43be2d65]

      [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-enforcer-plugin:1.0:enforce' with basic configurator -->

      [DEBUG]   (s) fail = true

      [DEBUG]   (s) failFast = false

      [DEBUG]   (f) ignoreCache = false

      [DEBUG]   (s) project = MavenProject: org.modeshape:modeshape-parent:3.0-SNAPSHOT @ /users/bwallis/InfoMedix/JBoss/ModeShape/workspace/modeshape-src/modeshape/modeshape-parent/pom.xml

      [DEBUG]   (f) message = To build this project JDK 6 (or greater) is required. Please install it.

      [DEBUG]   (s) version = 6

      [DEBUG]   (s) rules = [org.apache.maven.plugins.enforcer.RequireJavaVersion@622f996f]

      [DEBUG]   (s) session = org.apache.maven.execution.MavenSession@7746df77

      [DEBUG]   (s) skip = false

      [DEBUG] -- end configuration --

      [DEBUG] Executing rule: org.apache.maven.plugins.enforcer.RequireJavaVersion

      [DEBUG] Rule org.apache.maven.plugins.enforcer.RequireJavaVersion is cacheable.

      [DEBUG] Detected Java String: 1.6.0_33

      [DEBUG] Normalized Java String: 1.6.0-33

      [DEBUG] Parsed Version: Major: 1 Minor: 6 Incremental: 0 Build: 33 Qualifier: null

      [DEBUG] Adding failure due to exception

      org.apache.maven.enforcer.rule.api.EnforcerRuleException: To build this project JDK 6 (or greater) is required. Please install it.

                at org.apache.maven.plugins.enforcer.AbstractVersionEnforcer.enforceVersion(AbstractVersionEnforcer.java:101)

                at org.apache.maven.plugins.enforcer.RequireJavaVersion.execute(RequireJavaVersion.java:65)

                at org.apache.maven.plugins.enforcer.EnforceMojo.execute(EnforceMojo.java:186)

                at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

                at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

                at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)

                at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)

                at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)

                at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)

                at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)

                at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)

                at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)

                at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)

                at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)

                at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)

                at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)

                at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

      [WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:

      To build this project JDK 6 (or greater) is required. Please install it.

      {noformat}

       

      As you can see from the output the enforcer plugin has found the correct version of the JDK and it is version 6 but then claims that it isn't.

       

      Has anyone got this to build on a mac?

       

      thanks

        • 1. Re: Building 3.0-SNAPSHOT on Mac OSX
          kbachl

          Hi,

           

          I just build yesterday several Snapshots from main repo on OS X 10.7.4 - so far all went fine. Are you using the settings.xml during build?

          e.g: mvn clean install -s settings.xml

           

          If this still fails you could give java 7 a shot - its officially released by oracle for OS X, maybe this could help.

           

          Best

          • 2. Re: Building 3.0-SNAPSHOT on Mac OSX
            rhauch

            I develop on a Mac; I just upgraded to OS X 10.8 recently, and was on 10.7 for a while before that, and 10.6 before that.

             

            Here are my details:

             

            $ mvn --version

            Apache Maven 3.0.4 (r1232337; 2012-01-17 02:44:56-0600)

            Maven home: /usr/local/apache-maven-3.0.4

            Java version: 1.6.0_33, vendor: Apple Inc.

            Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

            Default locale: en_US, platform encoding: MacRoman

            OS name: "mac os x", version: "10.8", arch: "x86_64", family: "mac"

             

            This is the relevant section of the debug output for my build (notice the bold differences):

             

            [DEBUG] Configuring mojo org.apache.maven.plugins:maven-enforcer-plugin:1.0:enforce from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-enforcer-plugin:1.0, parent: sun.misc.Launcher$AppClassLoader@a6eb38a]

            [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-enforcer-plugin:1.0:enforce' with basic configurator -->

            [DEBUG]   (s) fail = true

            [DEBUG]   (s) failFast = false

            [DEBUG]   (f) ignoreCache = false

            [DEBUG]   (s) project = MavenProject: org.modeshape:modeshape-parent:3.0-SNAPSHOT @ /Users/rhauch/dev/java/modeshape/fork-git/modeshape-parent/pom.xml

            [DEBUG]   (f) message = To build this project JDK 1.6 (or greater) is required. Please install it.

            [DEBUG]   (s) version = 1.6

            [DEBUG]   (s) rules = [org.apache.maven.plugins.enforcer.RequireJavaVersion@6d3cba41]

            [DEBUG]   (s) session = org.apache.maven.execution.MavenSession@69127c4d

            [DEBUG]   (s) skip = false

            [DEBUG] -- end configuration --

            [DEBUG] Executing rule: org.apache.maven.plugins.enforcer.RequireJavaVersion

            [DEBUG] Rule org.apache.maven.plugins.enforcer.RequireJavaVersion is cacheable.

            [DEBUG] Detected Java String: 1.6.0_33

            [DEBUG] Normalized Java String: 1.6.0-33

            [DEBUG] Parsed Version: Major: 1 Minor: 6 Incremental: 0 Build: 33 Qualifier: null

            [DEBUG] Detected JDK Version: 1.6.0-33 is allowed in the range 1.6.

             

            To figure out why it's different, let's first look at the configuration of the enforcer earlier in the output:

             

            [DEBUG] -----------------------------------------------------------------------

            [DEBUG] Goal:          org.apache.maven.plugins:maven-enforcer-plugin:1.0:enforce (enforce-java-version)

            [DEBUG] Style:         Regular

            [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>

            <configuration>

              <fail default-value="true">${enforcer.fail}</fail>

              <failFast default-value="false">${enforcer.failFast}</failFast>

              <ignoreCache default-value="false">${enforcer.ignoreCache}</ignoreCache>

              <project>${project}</project>

              <rules>

                <requireJavaVersion>

                  <message>To build this project JDK 1.6 (or greater) is required. Please install it.</message>

                  <version>1.6</version>

                </requireJavaVersion>

              </rules>

              <session>${session}</session>

              <skip default-value="false">${enforcer.skip}</skip>

            </configuration>

            [DEBUG] -----------------------------------------------------------------------

             

            I suspect the bold "<version>1.6</version>" would actually have a value of "6" for you. This is set by the JBoss Parent POM; ModeShape's parent POM references version 9 of the JBoss parent POM, which is the latest released version and can be found in the Maven repository here. In that file is this section, and note the important parts are in bold:

             

            <!-- ************** -->

            <!-- Build settings -->

            <!-- ************** -->

            <!-- Cross plugins settings -->

            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

            <!-- maven-compiler-plugin -->

            <maven.compiler.target>1.6</maven.compiler.target>

            <maven.compiler.source>1.6</maven.compiler.source>

            <!--

            Options to override the compiler arguments directly on the compiler arument line to separate between what the IDE understands as the source level and what the Maven compiler actually use.

            -->

            <maven.compiler.argument.target>${maven.compiler.target}</maven.compiler.argument.target>

            <maven.compiler.argument.source>${maven.compiler.source}</maven.compiler.argument.source>

            <!-- maven-enforcer-plugin -->

            <!--

            Version 3.0-beta-1 includes strong POM validation and correct "import" scope dependency resolution.

            -->

            <maven.min.version>3.0</maven.min.version>

            <jdk.min.version>${maven.compiler.source}</jdk.min.version>

            <!-- maven-idea-plugin & maven-eclipse-plugin -->

            <downloadSources>true</downloadSources>

            <!-- maven-pmd-plugin -->

            <targetJdk>${maven.compiler.target}</targetJdk>

            <!-- maven-release-plugin -->

            <useReleaseProfile>false</useReleaseProfile>

            <arguments>-Pjboss-release</arguments>

             

             

            Is this what your cached JBoss parent POM looks like in your ~/.m2/repository? If so, might you be overriding the value of "jdk.min.version" with either your Maven environment properties or a command line parameter?

             

            • 3. Re: Building 3.0-SNAPSHOT on Mac OSX
              bwallis42

              The settings.xml file did the trick. Thanks

              • 4. Re: Building 3.0-SNAPSHOT on Mac OSX
                bwallis42

                Another build problem I'm afraid. Updated to the latest for the Beta3 release and ran a build with

                 

                {noformat}mvn clean install -s settings.xml -Passembly,as72{noformat}

                 

                and got this error

                 

                {noformat}

                [INFO] ModeShape Distribution ............................ FAILURE [9.115s]

                [INFO] ModeShape for JBoss AS (Integration Tests) ........ SKIPPED

                [INFO] ModeShape Integration Test Components ............. SKIPPED

                [INFO] ModeShape ......................................... SKIPPED

                [INFO] ------------------------------------------------------------------------

                [INFO] BUILD FAILURE

                [INFO] ------------------------------------------------------------------------

                [INFO] Total time: 11.710s

                [INFO] Finished at: Fri Aug 24 12:55:40 EST 2012

                [INFO] Final Memory: 31M/81M

                [INFO] ------------------------------------------------------------------------

                [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:javadoc (javadoc-all) on project modeshape-distribution: Execution javadoc-all of goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:javadoc failed: For artifact {rome:null:null:jar}: The artifactId cannot be empty. -> [Help 1]

                [ERROR]

                [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

                [ERROR] Re-run Maven using the -X switch to enable full debug logging.

                {noformat}

                Re-ran with the -X flag but nothing usefull was logged that I could find.

                • 5. Re: Building 3.0-SNAPSHOT on Mac OSX
                  bwallis42

                  Just did another build using

                   

                  {noformat}mvn clean install -s settings.xml{noformat}

                  and it worked but I don't get the as72 kit for installing it.

                  • 6. Re: Building 3.0-SNAPSHOT on Mac OSX
                    bwallis42

                    I did chase this one down in the end, I had a local project settings.xml file in ~/.m2 that has a maven comipler/source/target setting of 6.