java - Maven 无法解析 C3P0 依赖项

标签 java maven

我正在尝试使用以下 POM 文件进行构建,但 Maven 无法解析 C3P0 依赖项

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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.datapriviasoftware</groupId>
    <artifactId>cas-overlay</artifactId>
    <packaging>war</packaging>
    <version>1.0</version>

    <properties>
        <cas.version>4.1.3</cas.version>
        <hibernate.core.version>5.0.7.Final</hibernate.core.version>
        <maven-jetty-plugin.version>9.3.6.v20151106</maven-jetty-plugin.version>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                 <groupId>com.rimerosolutions.maven.plugins</groupId>
                 <artifactId>wrapper-maven-plugin</artifactId>
                 <version>0.0.4</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <warName>cas</warName>
                    <overlays>
                        <overlay>
                            <groupId>org.jasig.cas</groupId>
                            <artifactId>cas-server-webapp</artifactId>
                            <excludes>
                                <exclude>WEB-INF/cas.properties</exclude>
                                <exclude>WEB-INF/classes/log4j2.xml</exclude>
                            </excludes>
                        </overlay>
                    </overlays>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
        <finalName>cas</finalName>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.jasig.cas</groupId>
            <artifactId>cas-server-webapp</artifactId>
            <version>${cas.version}</version>
            <type>war</type>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.jasig.cas</groupId>
            <artifactId>cas-server-support-jdbc</artifactId>
            <version>${cas.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.core.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.core.version}</version>
        </dependency>
        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.5.2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo1.maven.org/maven2</url>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
        <repository>
            <id>sonatype-releases</id>
            <url>http://oss.sonatype.org/content/repositories/releases/</url>
        </repository>
        <repository>
            <id>sonatype-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
    </repositories>

</project>

当我运行 mvn clean install 时,出现以下错误

Downloading: http://oss.sonatype.org/content/repositories/releases/c3p0/c3p0/0.9.5.2/c3p0-0.9.5.2.jar
Downloading: https://oss.sonatype.org/content/repositories/snapshots/c3p0/c3p0/0.9.5.2/c3p0-0.9.5.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.330s
[INFO] Finished at: Thu Jan 14 14:21:45 EST 2016
[INFO] Final Memory: 10M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project cas-overlay: Could not resolve dependencies for project com.datapriviasoftware:cas-overlay:war:1.0: Could not find artifact c3p0:c3p0:jar:0.9.5.2 in central (https://repo1.maven.org/maven2) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

当我查看 Maven Central 时,我可以在此处找到依赖项:https://repo1.maven.org/maven2/com/mchange/c3p0/0.9.5.2/

我知道我必须做一些愚蠢的事情,请帮助我,这样我就可以吃一些乌鸦继续前进。

谢谢, 托尼

最佳答案

你的groupId是错误的。

尝试:

   <dependency>
        <groupId>com.mchange</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.5.2</version>
        <scope>provided</scope>
    </dependency>

关于java - Maven 无法解析 C3P0 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34798139/

相关文章:

java - Spring Boot : Get JSON body when RESTFul error (404, 403, 500) 发生

java - 使用 JAXB 编码内部类 - Java

java - 禁用按钮在火狐中工作正常,但在 IE 中不行

java - Maven javafx :jlink. 如何指定使用的模块路径?

eclipse - 本地主机上的服务器 Tomcat v8.0 服务器无法启动。这是错误快照

java - 如何在android java中使用jetpack导航和bottomNavigationView

java - 部署 war : No Spring WebApplicationInitializer types detected on classpath

java - Dagger 2 没有生成类

java - 如何使用 Eclipse 中的资源从 Maven 项目创建可运行的 jar

maven - Maven如何确定从命令行使用的插件使用哪个插件版本?