Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enforce HTTPS in ivy?

Tags:

java

maven

ant

ivy

Here is my ivy.xml.

<ivy-module version="2.0">
    <info organisation="kairosd.org" module="kairosdb"/>
    <configurations defaultconf="default" >
        <conf name="default"/>
        <conf name="integration" extends="test"/>
        <conf name="test" extends="default"/>
    </configurations>
    <dependencies>
        <dependency org="com.google.guava" name="guava" rev="19.0" force="true">
            <artifact name="guava" type="bundle" ext="jar"/>
        </dependency>
        <dependency org="com.github.rholder" name="guava-retrying" rev="2.0.0" />
        <dependency org="org.apache.commons" name="commons-lang3" rev="3.4" />
        <dependency org="org.apache.commons" name="commons-collections4" rev="4.1" />

        <dependency org="org.json" name="org.json" rev="chargebee-1.0" />
        <dependency org="com.google.code.gson" name="gson" rev="2.2.4" />
        <dependency org="junit" name="junit" rev="4.12" conf="test->default" />

        <dependency org="org.hamcrest" name="hamcrest-library" rev="1.3"
                    conf="test->default"/>
        <dependency org="org.mockito" name="mockito-core" rev="2.13.0" conf="test->default"/>
        <dependency org="io.netty" name="netty" rev="3.10.6.Final" />
        <dependency org="org.powermock" name="powermock-module-junit4" rev="1.4.12" />-->
        <dependency org="com.google.inject" name="guice" rev="4.1.0" />
        <dependency org="com.google.inject.extensions"
                    name="guice-multibindings" rev="4.1.0"/>
        <dependency org="com.google.inject.extensions" name="guice-assistedinject" rev="4.1.0" />
        <dependency org="com.google.inject.extensions" name="guice-servlet" rev="4.1.0" />
        <dependency org="com.h2database" name="h2" rev="1.3.170" />
        <dependency org="se.ugli.bigqueue" name="bigqueue" rev="1.6.0.0" />

        <!-- provides connection pooling -->
        <dependency org="c3p0" name="c3p0" rev="0.9.1.2"/>
        <dependency org="org.slf4j" name="slf4j-api" rev="1.7.2" />
        <dependency org="org.slf4j" name="jul-to-slf4j" rev="1.7.2" />
        <dependency org="org.apache.commons" name="commons-math3" rev="3.2" />
        <dependency org="commons-io" name="commons-io" rev="2.5" />
        <dependency org="com.beust" name="jcommander" rev="1.35" />
        <dependency org="org.apache.httpcomponents" name="httpclient" rev="4.3.6" />
        <dependency org="joda-time" name="joda-time" rev="2.3" />

        <dependency org="ch.qos.logback" name="logback-core" rev="1.1.7" />
        <dependency org="ch.qos.logback" name="logback-classic" rev="1.1.7" />

        <!--Genormous dependencies-->
        <dependency org="org.agileclick.genorm" name="genormous" rev="1.6.4.jdbc41">
            <exclude org="javax.servlet" name="servlet-api"/>
            <exclude org="org.agileclick.slickxml" name="slickxml"/>
            <exclude org="org.agileclick.ultramc" name="ultramc"/>
        </dependency>
        <dependency org="jaxen" name="jaxen" rev="1.1.6" transitive="false">
            <artifact name="jaxen" type="jar"/>
        </dependency>

        <!-- Cassandra Client -->
        <dependency org="com.datastax.cassandra" name="cassandra-driver-core" rev="3.3.2" />
        <dependency org="net.jpountz.lz4" name="lz4" rev="1.3.0"/>

        <!-- Jetty server stuff -->
        <dependency org="org.eclipse.jetty" name="jetty-server"
                    rev="8.1.16.v20140903"/>
        <dependency org="org.eclipse.jetty" name="jetty-servlet"
                    rev="8.1.16.v20140903"/>
        <dependency org="org.eclipse.jetty" name="jetty-servlets"
                    rev="8.1.16.v20140903"/>
        <dependency org="org.eclipse.jetty.orbit" name="javax.servlet" rev="3.0.0.v201112011016">
            <artifact name="javax.servlet" type="orbit" ext="jar"/>
        </dependency>

        <!--Jersey-->
        <dependency org="com.sun.jersey.contribs" name="jersey-guice"
                    rev="1.18.3"/>
        <dependency org="com.sun.jersey" name="jersey-server" rev="1.18.3"/>
        <dependency org="com.fasterxml.jackson.jaxrs" name="jackson-jaxrs-json-provider" rev="2.2.3"/>
        <dependency org="com.sun.jersey" name="jersey-core" rev="1.18.3"/>
        <dependency org="com.sun.jersey" name="jersey-servlet" rev="1.18.3"
                    transitive="false"/>
        <dependency org="com.sun.jersey.contribs.jersey-oauth" name="oauth-signature" rev="1.18.3" />
        <dependency org="com.sun.jersey.contribs.jersey-oauth" name="oauth-server" rev="1.18.3" />

        <!-- Pulse -->
        <dependency org="javax.validation" name="validation-api" rev="1.0.0.GA"/>
        <dependency org="org.apache.bval" name="bval-jsr303" rev="0.5"/>
        <dependency org="com.google.code.findbugs" name="jsr305" rev="1.3.9"/>

        <!-- Quartz -->
        <dependency org="org.quartz-scheduler" name="quartz" rev="2.1.7" />

        <!-- Codehale Metrics -->
        <dependency org="com.codahale.metrics" name="metrics-healthchecks"
                    rev="3.0.2"/>
        <dependency org="com.codahale.metrics" name="metrics-jvm" rev="3.0.2"/>

        <dependency org="org.testng" name="testng" rev="6.8.5" conf="integration->default"/>

        <!-- Prometheus -->
        <dependency org="io.prometheus" name="simpleclient" rev="0.1.0"/>
        <dependency org="io.prometheus" name="simpleclient_common" rev="0.1.0"/>
        <dependency org="io.prometheus" name="simpleclient_httpserver" rev="0.1.0"/>

    </dependencies>
</ivy-module>

ivysettings.xml:

<ivysettings>
    <settings defaultResolver="default"/>
    <resolvers>
        <ibiblio name="local-m2" m2compatible="true"
                 root="file://${user.home}/.m2/repository"
                 changingPattern=".*SNAPSHOT"/>
        <!--<ibiblio name="my-maven" m2compatible="true" root="http://repo.maven.apache.org/maven2/"/>-->
        <!--<ibiblio name="staging" m2compatible="true" root="https://oss.sonatype.org/content/repositories/orgagileclick-1008"/>-->
        <ibiblio name="central" m2compatible="true"/>

        <filesystem name="local-m2-publish" m2compatible="true">
            <artifact
                    pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
        </filesystem>

        <filesystem name="local-m2-publish-snapshot" m2compatible="true">
            <artifact
                    pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]-SNAPSHOT/[artifact]-[revision]-SNAPSHOT.[ext]"/>
        </filesystem>

        <chain name="default">
            <resolver ref="central"/>
            <!--<resolver ref="staging"/>-->
            <!--<resolver ref="local-m2"/>-->
        </chain>
    </resolvers>
</ivysettings>

This is the error I get.

===============================================
Ivy resolving dependencies.
:: problems summary ::
:::: WARNINGS
                module not found: junit#junit;4.12

        ==== central: tried

          http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.pom

          -- artifact junit#junit;4.12!junit.jar:

          http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar

                module not found: org.hamcrest#hamcrest-library;1.3

        ==== central: tried

          http://repo1.maven.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.pom

          -- artifact org.hamcrest#hamcrest-library;1.3!hamcrest-library.jar:

          http://repo1.maven.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar

                module not found: org.mockito#mockito-core;2.13.0

        ==== central: tried

          http://repo1.maven.org/maven2/org/mockito/mockito-core/2.13.0/mockito-core-2.13.0.pom

          -- artifact org.mockito#mockito-core;2.13.0!mockito-core.jar:

          http://repo1.maven.org/maven2/org/mockito/mockito-core/2.13.0/mockito-core-2.13.0.jar

                module not found: org.testng#testng;6.8.5

        ==== central: tried

          http://repo1.maven.org/maven2/org/testng/testng/6.8.5/testng-6.8.5.pom

          -- artifact org.testng#testng;6.8.5!testng.jar:

          http://repo1.maven.org/maven2/org/testng/testng/6.8.5/testng-6.8.5.jar

                ::::::::::::::::::::::::::::::::::::::::::::::

                ::          UNRESOLVED DEPENDENCIES         ::

                ::::::::::::::::::::::::::::::::::::::::::::::

                :: junit#junit;4.12: not found

                :: org.hamcrest#hamcrest-library;1.3: not found

                :: org.mockito#mockito-core;2.13.0: not found

                :: org.testng#testng;6.8.5: not found

                ::::::::::::::::::::::::::::::::::::::::::::::


:::: ERRORS
        SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.pom

        SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar

        SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.pom

        SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar

        SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/mockito/mockito-core/2.13.0/mockito-core-2.13.0.pom

        SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/mockito/mockito-core/2.13.0/mockito-core-2.13.0.jar

        SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/testng/testng/6.8.5/testng-6.8.5.pom

        SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/testng/testng/6.8.5/testng-6.8.5.jar

Exception tablesaw.TablesawException: Unable to resolve dependencies
Unable to resolve dependencies
===============================================

I think the error is due to HTTPS enforcement. How to do it?

like image 878
brainless Avatar asked Jan 25 '23 04:01

brainless


1 Answers

I fixed it by adding a resolver, my-maven, with https root and add it to the chain. It should also work if I change the root of the central resolver.

<ivysettings>
    <settings defaultResolver="default"/>
    <resolvers>
        <ibiblio name="local-m2" m2compatible="true"
                 root="file://${user.home}/.m2/repository"
                 changingPattern=".*SNAPSHOT"/>
        <ibiblio name="my-maven" m2compatible="true" root="https://repo1.maven.org/maven2/"/>
        <!--<ibiblio name="staging" m2compatible="true" root="https://oss.sonatype.org/content/repositories/orgagileclick-1008"/>-->
        <ibiblio name="central" m2compatible="true"/>

        <filesystem name="local-m2-publish" m2compatible="true">
            <artifact
                    pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
        </filesystem>

        <filesystem name="local-m2-publish-snapshot" m2compatible="true">
            <artifact
                    pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]-SNAPSHOT/[artifact]-[revision]-SNAPSHOT.[ext]"/>
        </filesystem>

        <chain name="default">
            <resolver ref="central"/>
            <resolver ref="my-maven"/>
            <!--<resolver ref="local-m2"/>-->
        </chain>
    </resolvers>
</ivysettings>
like image 110
brainless Avatar answered Jan 30 '23 01:01

brainless