How to properly specify jcenter repository in maven config?

后端 未结 3 1416
迷失自我
迷失自我 2021-02-13 01:44

In Gradle, I need simply add:

  repositories {  
   jcenter()  
  }

What is the simplest and proper way to do the same in maven pom.xml or wher

相关标签:
3条回答
  • 2021-02-13 02:36

    Just add a repositories section in your pom:

    <repositories>
        <repository>
            <id>jcenter</id>
            <name>jcenter</name>
            <url>https://jcenter.bintray.com</url>
        </repository>
    </repositories>
    
    0 讨论(0)
  • 2021-02-13 02:38

    You have to define settings.xml like the following. If you define it in ~/.m2/settings.xml it will be global to your maven. If you define it as a resource of your project you can bind it with the -s parameter:

    mvn -s settings.xml compile
    

    <?xml version="1.0" encoding="UTF-8" ?>
    <settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
              xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
        
        <profiles>
            <profile>
                <repositories>
                    <repository>
                        <snapshots>
                            <enabled>false</enabled>
                        </snapshots>
                        <id>central</id>
                        <name>bintray</name>
                        <url>https://jcenter.bintray.com</url>
                    </repository>
                </repositories>
                <pluginRepositories>
                    <pluginRepository>
                        <snapshots>
                            <enabled>false</enabled>
                        </snapshots>
                        <id>central</id>
                        <name>bintray-plugins</name>
                        <url>https://jcenter.bintray.com</url>
                    </pluginRepository>
                </pluginRepositories>
                <id>bintray</id>
            </profile>
        </profiles>
        <activeProfiles>
            <activeProfile>bintray</activeProfile>
        </activeProfiles>
    </settings>

    0 讨论(0)
  • 2021-02-13 02:42

    The official documentation from JFrog JCenter is in: https://bintray.com/bintray/jcenter

    Hit the SET ME UP! button on the upper right corner.

    0 讨论(0)
提交回复
热议问题