Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven could not resolve C3P0 dependency

Tags:

java

maven

I'm trying to build with the following POM file and Maven cannot resolve the C3P0 dependency

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>

When I run mvn clean install , I get the following error

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

When I look on Maven Central, I can find the dependency here: https://repo1.maven.org/maven2/com/mchange/c3p0/0.9.5.2/

I know I have to be doing something stupid, please help me so I can eat some crow and move on.

Thanks, Tony

like image 937
SGT Grumpy Pants Avatar asked Jan 14 '16 19:01

SGT Grumpy Pants


1 Answers

Your groupId is wrong.

Try:

   <dependency>
        <groupId>com.mchange</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.5.2</version>
        <scope>provided</scope>
    </dependency>
like image 81
JFPicard Avatar answered Nov 17 '22 04:11

JFPicard