Bug 786255

Summary: modules/plugins/jmx/pom.xml cannot build on MacOS - wrong path to tools.jar
Product: [Other] RHQ Project Reporter: Elias Ross <genman>
Component: Build SystemAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED DUPLICATE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 4.3CC: hrupp, ian.springer
Target Milestone: ---   
Target Release: RHQ 4.3.0   
Hardware: Unspecified   
OS: Mac OS   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-06 18:33:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 782579    

Description Elias Ross 2012-01-31 20:36:47 UTC
[ERROR] Failed to execute goal on project rhq-jmx-plugin: Could not resolve dependencies for project org.rhq:rhq-jmx-plugin:jar:4.3.0-SNAPSHOT: Could not find artifact com.sun:tools:jar:1.6.0 at specified path /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../lib/tools.jar -> [Help 1]

Pom has:

      <dependency>
         <groupId>com.sun</groupId>
         <artifactId>tools</artifactId>
         <version>1.6.0</version>
         <scope>system</scope>
         <systemPath>${java.home}/../lib/tools.jar</systemPath>
      </dependency>

See this solution: http://stackoverflow.com/questions/3080437/jdk-tools-jar-as-maven-dependency


This works on Mac OS X

diff --git a/modules/plugins/jmx/pom.xml b/modules/plugins/jmx/pom.xml
index 8780b32..714dc6a 100644
--- a/modules/plugins/jmx/pom.xml
+++ b/modules/plugins/jmx/pom.xml
@@ -30,7 +30,7 @@
          <artifactId>tools</artifactId>
          <version>1.6.0</version>
          <scope>system</scope>
-         <systemPath>${java.home}/../lib/tools.jar</systemPath>
+         <systemPath>${toolsjar}</systemPath>
       </dependency>
 
    </dependencies>
@@ -315,6 +315,30 @@
           </plugins>
        </build>
      </profile>
-   </profiles>
+        <profile>
+            <id>default-profile</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+                <file>
+                    <exists>${java.home}/../lib/tools.jar</exists>
+                </file>
+            </activation>
+            <properties>
+                <toolsjar>${java.home}/../lib/tools.jar</toolsjar>
+            </properties>
+        </profile>
+        <profile>
+            <id>mac-profile</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+                <file>
+                    <exists>${java.home}/../Classes/classes.jar</exists>
+                </file>
+            </activation>
+            <properties>
+                <toolsjar>${java.home}/../Classes/classes.jar</toolsjar>
+            </properties>
+        </profile>
+    </profiles>
 
 </project>

Comment 1 Ian Springer 2012-02-03 19:41:48 UTC
I'm confused as to why this is still not working. I checked in a fix to master a week or so ago that's similar to the one you're proposing. See https://bugzilla.redhat.com/show_bug.cgi?id=703557, comments 6-9. Can you shed any light?

Comment 2 Mike Foley 2012-02-06 17:02:35 UTC
per bz triage (asantos, ccrouch, mfoley. loleary)

Comment 3 Elias Ross 2012-02-06 18:33:07 UTC
master is working on Mac OS. I was working off an older branch off of master that still was broken.

*** This bug has been marked as a duplicate of bug 703557 ***