java - 在中央找不到 Artifact javax.sql :jdbc-stdext:jar:2. 0 (https ://repo. maven.apache.org/maven2)

标签 java eclipse rest maven jdbc

我正在尝试构建我为我的项目创建的网络服务的 REST API。 我的 Web 服务运行正常。

现在,我想在远程服务器上部署我的服务,我需要生成 war 文件。

我使用 Java、Eclipse 和 Maven 作为依赖项。我尝试进行全新安装,唯一失败的问题是:

[WARNING] The artifact jdbc:jdbc:jar:2.0 has been relocated to javax.sql:jdbc-stdext:jar:2.0
[INFO] Downloading: https://repo.maven.apache.org/maven2/javax/sql/jdbc-stdext/2.0/jdbc-stdext-2.0.jar
Could not find artifact javax.sql:jdbc-stdext:jar:2.0 in central (https://repo.maven.apache.org/maven2), try downloading from http://java.sun.com/products/jdbc/download.html

谁有解决办法?

P.S:为什么我在测试时没有遇到问题是因为我手动添加了 jdbc-stdext-2.0.jar 现在我遇到了麻烦。

我的 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>Tech4EarthServices</groupId>
<artifactId>Tech4EarthServices</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <warSourceDirectory>WebContent</warSourceDirectory>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
        <version>2.17</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
        <version>2.17</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20140107</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.6.0</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.6.0</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.6.0</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>2.19</version>
    </dependency>
    <dependency>
        <groupId>jdbc</groupId>
        <artifactId>jdbc</artifactId>
        <version>2.0</version>
        <exclusions>
            <exclusion>
                <artifactId>jdbc-stdext</artifactId>
                <groupId>javax.sql</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.6</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.1.7.RELEASE</version>
    </dependency>
</dependencies>

最佳答案

您遇到此问题是因为您包含了只有源包可用的 Artifact 。 jdbc.jdbc 的 Maven 依赖项被引用为二进制文件。

很可能您不需要包含该依赖项,因为这些接口(interface)是由您在其中运行 WAR 存档的 JEE 容器提供的。我建议完全删除带有排除部分的 jdbc Artifact 。

您可以浏览 jdbc/jdbc 上的可用内容Maven Central 的文件夹。事实上,它的扩展名已在 javax/sql 下删除在 Maven 中心。

关于java - 在中央找不到 Artifact javax.sql :jdbc-stdext:jar:2. 0 (https ://repo. maven.apache.org/maven2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33075830/

相关文章:

java - 我如何查看从 GSON JsonReader 收到了多少字节

java - 二叉树 - 后序

java - Logcat错误我不明白

java - 为 Spring Web 服务分离 REST API 和实现

java - REST 客户端 InboundJaxrsResponse Status 500 ,当尝试 POST 时

java - 具有冗余类型参数的泛型方法

java - 修改 switch 语句内的变量以便在 switch 外部使用

java - 如何在不同的控制台上以一种配置启动多个 Java 程序(使用 Eclipse)

java - JOptionPane 更大

java - restcontroller 和 application/x-www-form-urlencoded;charset=UTF-8 媒体类型的问题