Mike Jones wrote:
> Agreed. Hopefully someone with more Maven experience can suggest
> something more elegant.
>
Been playing around (in the 3rd level of maven hell).
You can just include the execution bits related to the profiles, for
example:
<profiles>
<profile>
<id>sun-jdk</id>
<activation>
<property>
<name>java.vendor</name>
<value>Sun Microsystems Inc.</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>compile-jersey</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant dir=".." target="compile" />
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-optional</artifactId>
<version>1.5.3-1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>not-sun-jdk</id>
<activation>
<property>
<name>java.vendor</name>
<value>!Sun Microsystems Inc.</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>compile-jersey</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant dir=".." target="compile" />
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-optional</artifactId>
<version>1.5.3-1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
And remove the compile execution bit form the non-profiled section.
Does that work for you on the Mac?
Still i would prefer something more elegant, but if that works for you i
will commit it back.
Paul.
> Mike
>
> 2008/5/23 Paul Sandoz <Paul.Sandoz_at_sun.com>:
>> Hi Mike,
>>
>> Many thanks for looking into this. Kind of frustrating to have to duplicate
>> everything...
>>
>> Paul.
>>
>> Mike Jones wrote:
>>> Hi
>>>
>>> My inelegant solution is to create two profiles - "sun-jdk" and
>>> "not-sun-jdk". Each profile then duplicates the contents of the
>>> "maven-install-plugin" with the "non-sun-jdk" omitting the tools.jar
>>> dependency. This allows the pom file to work on both my Linux and OS X
>>> boxes.
>>>
>>> http://pastebin.com/m6bf87383
>>>
>>> Maybe someone with more Maven experience can suggest a more elegant
>>> solution?
>>>
>>> Cheers
>>> Mike
>>>
>>> 2008/5/20 Mike Jones <mike.a.jones_at_gmail.com>:
>>>> I'll have a look. I managed to get it to work on OS X but that failed
>>>> on my Linux box.
>>>>
>>>> Cheers
>>>> Mike
>>>>
>>>> 2008/5/20 Paul Sandoz <Paul.Sandoz_at_sun.com>:
>>>>> Hi Mike,
>>>>>
>>>>> Any idea how i modify this:
>>>>>
>>>>>
>>>>> https://jersey.dev.java.net/source/browse/*checkout*/jersey/trunk/jersey/maven/pom.xml
>>>>>
>>>>> to resolve the issue?
>>>>>
>>>>> Thanks,
>>>>> Paul.
>>>>>
>>>>> Mike Jones wrote:
>>>>>> Hi Paul
>>>>>>
>>>>>> Thanks for that - I managed to build jersey and the Spring
>>>>>> contribution on my Linux box on the second attempt ... the first
>>>>>> attempt failed because sourceforge didn't want to give up FindBugs.
>>>>>>
>>>>>> However, I cannot get a build on Mac OS X. I get the following message:
>>>>>>
>>>>>> <snip>
>>>>>> Missing:
>>>>>> ----------
>>>>>> 1) sun.jdk:tools:jar:1.5.0
>>>>>>
>>>>>> Try downloading the file manually from the project website.
>>>>>>
>>>>>> Then, install it using the command:
>>>>>> mvn install:install-file -DgroupId=sun.jdk -DartifactId=tools \
>>>>>> -Dversion=1.5.0 -Dpackaging=jar -Dfile=/path/to/file
>>>>>>
>>>>>> Path to dependency:
>>>>>> 1) org.apache.maven.plugins:maven-antrun-plugin:maven-plugin:1.1
>>>>>> 2) sun.jdk:tools:jar:1.5.0
>>>>>> </snip>
>>>>>>
>>>>>> I think this is due to the way that tools.jar is defined in the pom:
>>>>>>
>>>>>> http://maven.apache.org/general.html#tools-jar-dependency
>>>>>>
>>>>>> Thanks
>>>>>> Mike
>>>>>>
>>>>>>
>>>>>> 2008/5/20 Paul Sandoz <Paul.Sandoz_at_sun.com>:
>>>>>>> Hi Mike,
>>>>>>>
>>>>>>> Mike Jones wrote:
>>>>>>>> Hello
>>>>>>>>
>>>>>>>> I managed to get an earlier version of the spring integration with
>>>>>>>> Jersey compiled and working - however, I am now having a bit of
>>>>>>>> trouble.
>>>>>>>>
>>>>>>>> The steps I have taken:
>>>>>>>>
>>>>>>>> Checkout the trunk version of Jersey and install it into my local
>>>>>>>> repo:
>>>>>>>>
>>>>>>>> mvn install:install-file -Dfile=./jersey.jar -DgroupId=com.sun.jersey
>>>>>>>> \
>>>>>>>> -DartifactId=jersey -Dversion=0.8-ea-SNAPSHOT -Dpackaging=jar
>>>>>>>>
>>>>>>>> Checkout the latest JSR-311 spec and install it into my local repo:
>>>>>>>>
>>>>>>>> mvn install:install-file -Dfile=./jsr311-api.jar
>>>>>>>> -DgroupId=javax.ws.rs
>>>>>>>> \ -DartifactId=jsr311-api -Dversion=0.8-SNAPSHOT -Dpackaging=jar
>>>>>>>>
>>>>>>> You only need to check out the Jersey distribution. Please use the 311
>>>>>>> API
>>>>>>> in the Jersey SVN, namely:
>>>>>>>
>>>>>>> trunk/jersey/lib/jsr311-api.jar
>>>>>>>
>>>>>>> If you do the following from trunk/jersey:
>>>>>>>
>>>>>>> mvn -f maven/pom.xml clean install
>>>>>>>
>>>>>>> then the 311 API and Jersey will get installed in the local repo using
>>>>>>> the
>>>>>>> poms in:
>>>>>>>
>>>>>>> trunk/jersey/maven
>>>>>>>
>>>>>>> Then i go to the directory:
>>>>>>>
>>>>>>> trunk/contribs/spring
>>>>>>>
>>>>>>> and do:
>>>>>>>
>>>>>>> mvn install
>>>>>>>
>>>>>>>
>>>>>>> Hope that works,
>>>>>>> Paul.
>>>>>>>
>>>>>>>
>>>>>>>> To get the spring contribution to compile and pass some tests I
>>>>>>>> needed
>>>>>>>> to add the following dependencies to the pom.xml file:
>>>>>>>>
>>>>>>>> <dependency>
>>>>>>>> <groupId>javax.ws.rs</groupId>
>>>>>>>> <artifactId>jsr311-api</artifactId>
>>>>>>>> <version>0.8-SNAPSHOT</version>
>>>>>>>> </dependency>
>>>>>>>>
>>>>>>>> <dependency>
>>>>>>>> <groupId>javax.xml.bind</groupId>
>>>>>>>> <artifactId>jaxb-api</artifactId>
>>>>>>>> <version>2.2</version>
>>>>>>>> </dependency>
>>>>>>>>
>>>>>>>> <dependency>
>>>>>>>> <groupId>javax.annotation</groupId>
>>>>>>>> <artifactId>jsr250-api</artifactId>
>>>>>>>> <version>1.0</version>
>>>>>>>> </dependency>
>>>>>>>>
>>>>>>>> <dependency>
>>>>>>>> <groupId>asm</groupId>
>>>>>>>> <artifactId>asm</artifactId>
>>>>>>>> <version>3.1</version>
>>>>>>>> </dependency>
>>>>>>>>
>>>>>>>> However, a number of tests are still failing. For example:
>>>>>>>>
>>>>>>>> Tests run: 28, Failures: 17, Errors: 0, Skipped: 0, Time elapsed:
>>>>>>>> 6.132 sec <<< FAILURE!
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> testGetAndUpdateItem(com.sun.jersey.spring.AutowiredByJerseySpringSingletonResourceTest)
>>>>>>>> Time elapsed: 0.049 sec <<< FAILURE!
>>>>>>>> com.sun.jersey.api.client.UniformInterfaceException
>>>>>>>> at
>>>>>>>> com.sun.jersey.api.client.WebResource.handle(WebResource.java:346)
>>>>>>>> at
>>>>>>>> com.sun.jersey.api.client.WebResource.get(WebResource.java:81)
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>> com.sun.jersey.spring.AutowiredByJerseySpringSingletonResourceTest.testGetAndUpdateItem(AutowiredByJerseySpringSingletonResourceTest.java:44)
>>>>>>>>
>>>>>>>> I'm still working out how to get pass this issue. However, am I on
>>>>>>>> the
>>>>>>>> right path for compiling the spring contribution? Am i missing an ant
>>>>>>>> or maven target?
>>>>>>>>
>>>>>>>> Sorry if I am being a bit dim :-)
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>> Mike
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>>>>
>>>>>>> --
>>>>>>> | ? + ? = To question
>>>>>>> ----------------\
>>>>>>> Paul Sandoz
>>>>>>> x38109
>>>>>>> +33-4-76188109
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>>
>>>>> --
>>>>> | ? + ? = To question
>>>>> ----------------\
>>>>> Paul Sandoz
>>>>> x38109
>>>>> +33-4-76188109
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>
>>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>> --
>> | ? + ? = To question
>> ----------------\
>> Paul Sandoz
>> x38109
>> +33-4-76188109
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109