在中央仓库(https://repo.maven.apache.org/maven2)中找不到javax.sql:jdbc-stdext:jar:2.0的工件。

3
我正在尝试构建一个与我的项目相关的Web服务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

有人有解决方案吗?

附言:为什么我在测试时没有遇到问题,因为我手动添加了 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>


1
你能否包含你的POM文件中相关的部分? - Tim Biegeleisen
检查更新(我已经添加了pom.xml)。 - Ayyoub
2个回答

3
你遇到了问题,是因为你包含的构件只有源代码包可用。 Maven 依赖项 jdbc.jdbc 被引用为二进制。

很可能你不需要包含该依赖项,因为这些接口由你运行 WAR 存档的 JEE 容器提供。我建议完全删除带有排除部分的 jdbc 构件。
你可以浏览 Maven 中央库中 jdbc/jdbc 文件夹中的内容。确实它的扩展名已在 Maven 中央库的 javax/sql 下被移除。

非常感谢,我不得不移除这个代码块,结果它起作用了。在此之前,我会给你一个+1并接受你的答案。 - Ayyoub

1
我认为这是因为您在pom中将该工件列为排除项。例如:
<exclusions>
    <exclusion>
        <artifactId>jdbc-stdext</artifactId>
        <groupId>javax.sql</groupId>
    </exclusion>
</exclusions>

我认为如果您移除这个块,就可以解决问题了。

感谢@Tunaki的编辑,但是网站不允许我以XML格式发布代码块。一直提示格式不正确,最终我放弃了。 - Molefe

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接