Hi Russ,

Thanks for the info!

Unfortunately I had tried something similar before, and it doesn't work.

I added the profile section, declared the plugin as follows:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.6</version>
                <dependencies>
                    <dependency>
                        <groupId>com.sun</groupId>
                        <artifactId>tools</artifactId>
                        <version>1.6</version>
                        <scope>system</scope>
                        <systemPath>${tools-jar}</systemPath>
                    </dependency>
                </dependencies>
            </plugin>

I still get the following error:

[ERROR] Failed to execute goal on project enstratius-backend-server: Could
not resolve dependencies for project
com.enstratius:enstratius-backend-server:jar:j.0-pre1-SNAPSHOT: Could not
find artifact com.sun:tools:jar:0 at specified path
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../lib/tools.jar
-> [Help 1]

I'm guessing that because cobertura itself declares a profile, is mine not
overriding it (see my reply on Aug 29)

cheers,

David





On Tue, Oct 1, 2013 at 2:02 AM, Russell Gold <r...@gold-family.us> wrote:

> Hi David,
>
> I am really sorry. I had totally forgotten about your question.
>
> It's actually very straightforward. The profiles below will select for the
> correct version of the tools jar, just by looking for it. Then you just use
> that defined property in the dependency.
>
>
>     <dependencies>
>         <dependency>
>             <groupId>com.sun</groupId>
>             <artifactId>tools</artifactId>
>             <version>1.6</version>
>             <scope>system</scope>
>             <systemPath>${tools-jar}</systemPath>
>         </dependency>
>     </dependencies>
>
>     <profiles>
>         <profile>
>             <id>standard-jdk</id>
>             <activation>
>                 <file>
>                     <exists>${java.home}/../lib/tools.jar</exists>
>                 </file>
>             </activation>
>             <properties>
>                 <tools-jar>${java.home}/../lib/tools.jar</tools-jar>
>             </properties>
>         </profile>
>         <profile>
>             <id>apple-jdk</id>
>             <activation>
>                 <file>
>                     <exists>${java.home}/../Classes/classes.jar</exists>
>                 </file>
>             </activation>
>             <properties>
>                 <tools-jar>${java.home}/../Classes/classes.jar</tools-jar>
>             </properties>
>         </profile>
>     </profiles>
>
>
>
> On Aug 29, 2013, at 9:27 AM, David Hay <david....@enstratius.com> wrote:
>
> Hi Russ,
>
> Java 1.6.  Everything is fine compiling etc..  Here's what mvn -v shows:
>
> Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
> Maven home: /usr/share/maven
> Java version: 1.6.0_45, 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.3", arch: "x86_64", family: "mac"
>
> I have dug a little deeper, and it appears that Cobertura itself is
> setting the tools version to 0.  In the cobertura (itself, not the plugin)
> pom, there is a profile that sets the location of the variable <toolsjar>
> for different OS's.  For the mac it is incorrect (for mine anyway):
>
>     <profile>
>       <id>OSXProfile</id>
>       <activation>
>         <os>
>           <family>mac</family>
>         </os>
>       </activation>
>       <properties>
>         <toolsjar>${java.home}/../lib/tools.jar</toolsjar>
>       </properties>
>     </profile>
>
> I have tried to override with my own profile, to no avail - it always
> seems to look for lib/tools.jar instead of Classes/classes.jar.
>
> Any ideas how to override the location of toolsjar?
>
> cheers,
>
> David
>
>
> On Wed, Aug 28, 2013 at 11:30 PM, Russell Gold <r...@gold-family.us>wrote:
>
>> Hi David,
>>
>> What version of java are you running? How have you configured your pom to
>> find it?
>>
>> - Russ
>>
>> On Aug 28, 2013, at 5:13 PM, David Hay <david....@enstratius.com> wrote:
>>
>> Hi,
>>
>> Just tried to add the cobertura plugin to our maven build, and I get this
>> strange error.
>>
>> I'm running on a Mac (OS X 10.8.3) and apparently the tools.jar contents
>> has been added to classes.jar on this OS.  However, I tried to set the
>> dependency to a systemPath, which points to
>> JAVA_HOME/../Classes/classes.jar and it seems to ignore that completely and
>> still look for it in lib/tools.jar:
>>
>>     "Could not find artifact com.sun:tools:jar:0 at specified path
>> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../lib/tools.jar"
>>
>> Can anyone explain why the version is '0'?  And does anyone know how I
>> can get this working on a Mac?
>>
>> cheers,
>>
>> David
>>
>>
>>  -----------------
>> Come read my webnovel, *Take a Lemon *<http://www.takealemon.com>,
>> and listen to the Misfile radio play <
>> http://www.fuzzyfacetheater.com/misfile/>!
>>
>>
>>
>>
>>
>>
>
> -----------------
> Author, Getting Started with Apache 
> Maven<http://www.packtpub.com/getting-started-with-apache-maven/video>
>
> Come read my webnovel, *Take a Lemon *<http://www.takealemon.com>,
> and listen to the Misfile radio play <
> http://www.fuzzyfacetheater.com/misfile/>!
>
>
>
>
>
>
>

Reply via email to