Seems that there is some kind of "weight" system playing here:
$ aptitude why ant openjdk-7-jdk
p ant Recommends ant-optional
p ant-optional Suggests libgnumail-java
p libgnumail-java Suggests libgnumail-java-doc
p libgnumail-java-doc Recommends default-jdk-doc
p default-jdk-doc Depends openjdk-7-doc
p openjdk-7-doc Suggests openjdk-7-jdk
As you can see ant depends of openjdk-7-jdk due a complicated and intricated amounts of suggestions, recommendations and dependency, while when using openjdk-6-jdk the dependency is more direct:
$ aptitude why ant openjdk-6-jdk
p ant Suggests default-jdk | java-compiler | java-sdk
p openjdk-6-jdk Provides java-sdk
Of course aptitude methods of dependency resolution, could be different of apt-get's. BTW, running a simulation of ant without openjdk-7-jdk installed don't pulled openjdk-6-jdk:
$ sudo apt-get install ant
[sudo] password for braiam:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
ant-optional
Suggested packages:
default-jdk java-compiler java-sdk ant-gcj ant-doc liboro-java junit
libregexp-java jython antlr libbcel-java libjdepend-java libgnumail-java
libcommons-net-java libjsch-java javacc ant-optional-gcj
The following NEW packages will be installed:
ant ant-optional
0 upgraded, 2 newly installed, 0 to remove and 9 not upgraded.
Need to get 2,234 kB of archives.
After this operation, 3,041 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Maybe if you use the same methods as I did, you could figure out more, since I'm using Debian testing right now and repositories could have changed in the meanwhile.
apt-get install -o Debug::pkgProblemResolver=true package1 package2.... That might give you a hint why it's working that way. – Lasall Feb 17 '13 at 15:56