Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

apache - "Ignoring InnerClasses attribute" warning is killing Eclipse

I have a couple of imported jars that have this error in Eclipse when the project builds:

[2011-04-08 16:31:48 - MokbeeAndroid] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(net.sf.antcontrib.logic.ForEach$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.

Now, I didn't really care at first, because there were no errors. But I've now added Apache Sanselan, which has the same problem. Other Apache jars also do this, and not just once per jar, but once per class-that-has-an-inner-class, which makes every build pump out a monstrous console log. Worse, each warning seems to slow the Eclipse build process, and eventually Eclipse just crashes due to a memory overflow error. It's at the point where I can't build anything, even straight after my computer starts up.

The solution would seem to be to recompile the source (open-source and all), but none of it can be recompiled in anything but Maven, which, after doing so to no avail, I suspect is causing the problem in the first place.

I don't care about the results of the warning, just that Eclipse doesn't spend all it's memory on telling me about it. So, is there a way I can either remove the problem, or make Eclipse stop slowing down on it (skipping that check, maybe)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This was causing me a lot of pain with the android-maven-plugin and other libraries that included commons-logging. It was blocking my build. What made it worse is that some libraries were included transitively, so simply using <exclude> would not work. With a little hint from another post, I determined I could keep out the offending library altogether with something like this:

    <!-- prevent commons-logging from being included by the Google HTTP client 
        dependencies -->
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
        <scope>provided</scope>
    </dependency>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...