On 9 January 2015 at 00:47, Bernd Eckenfels <e...@zusammenkunft.net> wrote: > Am Fri, 9 Jan 2015 00:38:31 +0000 > schrieb sebb <seb...@gmail.com>: > >> Just tried the animal sniffer on NET (Java 1.5) - I added a call to >> new IOException(new Exception()) which is Java 1.6+ > > What Java did you use to start maven? Looks like Animal sniffer itself > uses Java 7 API.
Java 7, but I just tried Java 6 and that worked the same. I raised a bug about the unhelpful output. There are some bug reports which suggest that the plugin is not 100% accurate compared with a compiler. So at best the plugin can be used to detect some API violations. I think we still need to build and test with the appropriate Java version. > Gruss > Bernd > >> It does detect the reference, but the error message is pretty hopeless >> - it does not show the class or even the jar in which it is found. >> Instead there are a load of what appear to be debug lines: >> >> [ERROR] Failed to execute goal >> org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check >> (checkAPIcompat) on project commons-net: Execution checkAPIcompat of >> goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check failed: >> An API incompatibility was encountered while executing >> org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check: >> java.lang.NoSuchMethodError: >> java.nio.CharBuffer.subSequence(II)Ljava/nio/CharBuffer; >> [ERROR] ----------------------------------------------------- >> [ERROR] realm = >> plugin>org.codehaus.mojo:animal-sniffer-maven-plugin:1.13 [ERROR] >> plugin>strategy = >> plugin>org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy >> [ERROR] urls[0] = >> file:/Users/sebb/.m2/repository/org/codehaus/mojo/animal-sniffer-maven-plugin/1.13/animal-sniffer-maven-plugin-1.13.jar >> [ERROR] urls[1] = >> file:/Users/sebb/.m2/repository/org/codehaus/mojo/animal-sniffer/1.13/animal-sniffer-1.13.jar >> [ERROR] urls[2] = >> file:/Users/sebb/.m2/repository/org/ow2/asm/asm-all/4.0/asm-all-4.0.jar >> [ERROR] urls[3] = >> file:/Users/sebb/.m2/repository/org/codehaus/mojo/java-boot-classpath-detector/1.13/java-boot-classpath-detector-1.13.jar >> [ERROR] urls[4] = >> file:/Users/sebb/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.1/maven-reporting-api-2.0.1.jar >> [ERROR] urls[5] = >> file:/Users/sebb/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-6/doxia-sink-api-1.0-alpha-6.jar >> [ERROR] urls[6] = >> file:/Users/sebb/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar >> [ERROR] urls[7] = >> file:/Users/sebb/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar >> [ERROR] urls[8] = >> file:/Users/sebb/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.4/maven-common-artifact-filters-1.4.jar >> [ERROR] urls[9] = >> file:/Users/sebb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar >> [ERROR] Number of foreign imports: 1 >> [ERROR] import: Entry[import from realm ClassRealm[maven.api, >> parent: null]] [ERROR] >> >> However, it does detect the error even if it does not provide any help >> in finding it. >> >> On 8 January 2015 at 22:33, sebb <seb...@gmail.com> wrote: >> > On 8 January 2015 at 21:21, Thomas Neidhart >> > <thomas.neidh...@gmail.com> wrote: >> >> On 01/08/2015 07:12 PM, sebb wrote: >> >>> On 8 January 2015 at 17:29, Benedikt Ritter >> >>> <benerit...@gmail.com> wrote: >> >>>> >> >>>> >> >>>> Send from my mobile device >> >>>> >> >>>>> Am 08.01.2015 um 17:38 schrieb Thomas Neidhart >> >>>>> <thomas.neidh...@gmail.com>: >> >>>>> >> >>>>>> On 01/08/2015 05:24 PM, sebb wrote: >> >>>>>>> On 8 January 2015 at 16:13, Thomas Neidhart >> >>>>>>> <thomas.neidh...@gmail.com> wrote: >> >>>>>>>> On 01/08/2015 04:44 PM, sebb wrote: >> >>>>>>>>> On 8 January 2015 at 11:45, Thomas Neidhart >> >>>>>>>>> <thomas.neidh...@gmail.com> wrote: On 01/08/2015 12:25 PM, >> >>>>>>>>> sebb wrote: We certainly need to add animal-sniffer to our >> >>>>>>>>> release building process to detect such things. >> >>>>>>>> >> >>>>>>>> Does that actually detect such things? >> >>>>>>> >> >>>>>>> yes, that's the intention of this tool, and there is even a >> >>>>>>> maven plugin: >> >>>>>>> >> >>>>>>> http://mojo.codehaus.org/animal-sniffer-maven-plugin/index.html >> >>>>>> >> >>>>>> This suggests one has to create the API signature first. >> >>>>>> Which means one has to have access to the appropriate JDK >> >>>>>> anyway. >> >>>>>> >> >>>>>> But I now see that some sigs are already provided. >> >>>>> >> >>>>> here is an example of the usage: >> >>>>> >> >>>>> <plugin> >> >>>>> <groupId>org.codehaus.mojo</groupId> >> >>>>> <artifactId>animal-sniffer-maven-plugin</artifactId> >> >>>>> <version>1.13</version> >> >>>>> ... >> >>>>> <configuration> >> >>>>> ... >> >>>>> <signature> >> >>>>> <groupId>org.codehaus.mojo.signature</groupId> >> >>>>> <artifactId>java15</artifactId> >> >>>>> <version>1.0</version> >> >>>>> </signature> >> >>>>> ... >> >>>>> </configuration> >> >>>>> ... >> >>>>> </plugin> >> >>>>> >> >>>>> signatures for the various jdk versions are already available. >> >>>>> We could add different profiles to the parent depending on the >> >>>>> maven.compiler.source property. >> >>>>> >> >>> >> >>> A pity that the signatures are not called java1.5 etc. >> >>> That would allow one to do: >> >>> >> >>> <artifactId>java${ maven.compiler.source}</artifactId> >> >>> >> >>> Maybe there is a way to drop the "." from the source property? >> >> >> >> its a pity maven does not support powerful property substitutions >> >> like in ksh for example: >> >> >> >> http://www.softpanorama.org/Scripting/Shellorama/String_operations/ksh_substitutions.shtml >> >> >> >> Is there a pending feature request for this? >> >> >> >> What I have found is this: >> >> >> >> http://maven.40175.n5.nabble.com/String-manipulation-in-POM-td124186.html >> >> >> >> by using the gmaven-plugin you can create new properties based on >> >> original ones using standard string manipulation functions. >> > >> > Looks like build helper can do it too: >> > >> > http://mojo.codehaus.org/build-helper-maven-plugin/regex-property-mojo.html >> > >> >>> If not, then profiles will work (but require more code). >> >>> >> >>>> Very nice! >> >>>> >> >>>>> Thomas > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org