On 1 Aug 2011, at 21:18, Stuart McCulloch wrote:

> On 1 Aug 2011, at 21:14, Marshall Schor wrote:
> 
>> In our project we specify Java 5 (for backwards compatibility) and run Maven
>> using Java 5, so we can catch errors where code inadvertently depends on 
>> methods
>> not in Java 5 but rather, introduced in Java 6.  Merely setting the Maven
>> compile source and target to 1.5 doesn't catch these kinds of errors. 

PS. you can use the animal sniffer plugin to catch them:

  http://mojo.codehaus.org/animal-sniffer-maven-plugin/usage.html

which is useful when developing on platforms where a Java 5 JDK is hard to find

( unfortunately this wasn't enabled for the bnd / bundleplugin projects )

>> For example, in Java 6 a method was added to the String class for 
>> getBytes(...)
>> which takes an argument of Charset.
>> This method is not in Java 5.
>> 
>> The Felix bundle (release 2.3.5) appears to use this very method, and, thus,
>> requires Java 6 to run it, because after switching to 2.3.5, I see an 
>> exception
>> with this traceback:
>> 
>> Caused by: java.lang.NoSuchMethodError: 
>> java.lang.String.getBytes(Ljava/nio/charset/Charset;)[B
>>      at aQute.lib.osgi.Jar.<clinit>(Jar.java:290)
>>      at 
>> org.apache.felix.bundleplugin.BundlePlugin.getClasspath(BundlePlugin.java:942)
>>      at 
>> org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:261)
>>      at 
>> org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:252)
>>      at 
>> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>> 
>> 
>> Is this intentional (that Java 6 is a requirement to run the 
>> maven-bundle-plugin)? 
> 
> not intentional - https://issues.apache.org/jira/browse/FELIX-3037 - happened 
> when we picked up the new version of bnd
> 
> if you don't need any of the changes in 2.3.5 you can lock down the plugin 
> version to 2.3.4, which does work with Java 5
> 
>> -Marshall Schor
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to