简体   繁体   English

使用maven / ivy存储库获取java rt.jar

[英]Using maven / ivy repository to get java rt.jar

JDKs get installed in different places on different machines, I want to be able to support building with Java 7 targeting a Java 6 runtime. JDK安装在不同机器上的不同位置,我希望能够支持使用Java 7构建目标Java 6运行时。

I can specify -source 1.6 -target 1.6 to tell javac to target that runtime environment. 我可以指定-source 1.6 -target 1.6来告诉javac定位该运行时环境。 I can specify a -Xbootclasspath to tell it use a specific runtime jar 我可以指定-Xbootclasspath来告诉它使用特定的运行时jar

However Java 7 doesn't install java 6 runtime jars (not surprisingly). 但是,Java 7不会安装java 6运行时jar(不足为奇)。

When I look in the maven repository it just seems to have just up to 1.5: http://mvnrepository.com/artifact/com.sun/rt 当我查看maven存储库时,它似乎只有1.5: http//mvnrepository.com/artifact/com.sun/rt

Has the group id changed in 1.6? 群组ID是否已在1.6中更改? Is it available via a maven / ivy dependency? 它可以通过maven / ivy依赖吗?

You can manually add artifacts to a local maven repository (fe nexus or artifactory) and declare a dependency on that in your pom. 您可以手动将工件添加到本地maven存储库(fe nexus或ar​​tifactory),并声明对pom中的工件的依赖关系。

On the other hand: If you have a jdk installed you have already all classes in place to build for lower level runtimes, so there should be no need for the approach you described. 另一方面:如果你安装了一个jdk,你已经有了所有的类来构建较低级别的运行时,所以不需要你所描述的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM