On 10 October 2011 21:15, Eric Kolotyluk <eric.koloty...@gmail.com> wrote:
> OK, I still clearly do not understand how sniffer is supposed to work, and
> it does not look like am going to any time soon, even after all these
> explanations.
>
> As it is, I am making better progress now just by specifying the Java 5
> compiler in my maven-compiler-plugin. It complains right away when the
> artifact has Java 6 class files in it and prints an error message
> identifying the troublesome jar file. I am not really sure why no-one
> recommended this to me in the first place as it effective and simple to
> understand.
>
> Again, I am at a complete loss to fathom any utility in the sniffer. Maybe I
> am just too stupid to get it.
>
> Cheers, Eric
>
> On 2011-10-10 9:49 AM, Wayne Fay wrote:
>>>
>>> The problem is I cannot figure out the intent of how the sniffer is
>>> supposed
>>> to work - in particular if it will even help with my particular problem.
>>> As
>>> far as I can tell the Hibernate folks have not set up the necessary
>>> signatures for the sniffer to tell me what I need to know.
>>
>> You should not need to set up signatures. The community has already
>> done that for you. Just use an artifact under the groupId
>> org.codehaus.mojo.signature and specify the Java version you are
>> looking to target (most likely java15-sun in your case).
>
> I do not know what you mean...
>>
>>> When generating signatures, are we supposed to create a separate Maven
>>> project/artifact for the signature? For example
>>
>> I don't believe this is something you need to worry about. Just use
>> the existing signatures. Why would you be generating signatures
>> anyway?
>
> I have no idea because I do not know what the intent of the sniffer is or
> how it is supposed to work.

The intent of animal sniffer is to allow you to use
<source>1.5</source> with a 1.6 JDK and not accidentally link to
methods like java.lang.String#isEmpty()

Setting the source to 1.5 will only flush out the class format... the
signatures of methods used can only be enforced by the sniffer.

You run it on all your classes with the signatures you want to enforce
on your code... if you use a method outside those signatures it will
fail the build for you.

HTH

-Stephen

>>
>>> It is not that I need 1.6 features - it is that somewhere I am pulling in
>>> a
>>> JAR file via Maven that has version 50 class files from Java 6 and the
>>> Java
>>> 5 run time can only recognize version 49 or earlier. I am trying to pin
>>> down
>>> which JAR file exactly, and then determine if there is an earlier version
>>> of
>>> the artifact that has version 49 class files.
>>
>> If you set up the plugin properly, it should check all of YOUR code to
>> ensure it only uses JDK5 APIs. It will not help with code in your
>> dependencies (that I am aware of at least).
>>
>> If you want to check the Hibernate artifacts (jars), you should
>> probably just use the Animal Sniffer ant tasks and write a little Ant
>> to compare each Hibernate jar against the jdk15 signature:
>>
>> http://mojo.codehaus.org/animal-sniffer/animal-sniffer-ant-tasks/examples/checking-signatures.html
>>
>> Wayne
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to