我是maven的新手。 我正在尝试一个简单的maven项目,我想在其中包含来自maven中央存储库的核心java库。 我从search.maven.org
中找到了这种依赖<modelVersion>4.0.0</modelVersion>
<groupId>com.sun</groupId>
<artifactId>rt</artifactId>
<version>1.5.0_06</version>
<name>Sun Java Runtime Environment</name>
<description>Java Runtime Environment that can be found in Sun's JRE lib folder</description>
但maven将rt的pom存储在本地存储库中,我无法访问具有java核心库的rt jar。
答案 0 :(得分:0)
我建议遵循:
#使用Eclipse创建maven项目
#打开pom.xml并添加以下构建标记
请参阅下面的示例pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ays</groupId>
<artifactId>java-solution</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<!-- Added Java8 support -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
#右键单击Project并选择Maven-&gt;更新项目......
#刷新您的项目,您将看到JRE系统库[JavaSE-1.8]
#希望这会有所帮助!!