You can exclude a dependency by specifying it like this - in your case, you would exclude the jdk12
one:
<dependency>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk12</artifactId>
</exclusion>
</exclusions>
</dependency>
This way, only the jdk16
one should be pulled in.
If you need to pull in one of the two based on where you're building and which version of the JDK is installed, you can use profiles to distinguish, e.g. like this:
<profile>
<id>jdk12</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.2</jdk>
</activation>
<dependencies>
<dependency>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
<profile>
<id>jdk16</id>
<activation>
<jdk>1.6</jdk>
</activation>
<dependencies>
<dependency>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk12</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
Example taken from: http://svn.apache.org/repos/asf/webservices/wss4j/trunk/pom.xml