Gradle Modifying the Maven warehouse address

Source: Internet
Author: User
Tags jcenter

Gradle Install---

Http://www.itnose.net/detail/6500082.html

Http://stackoverflow.com/questions/5102571/how-to-install-maven-artifact-with-sources-from-command-line

----------

MVN Source:jar Install to install the Maven artifacts.

It's quite easy with Eclipse, right click on the Project Explorer view, click Maven menu item, then click Downlo Ad Sources:

------------

There's a tricky problem with Maven:

is to add dependencies because there is no download and associated source code, resulting in automatic prompt cannot appear the correct method name, and do not install the anti-compiler in the case can not enter the method to see the implementation of the internal.

In fact, the Eclipse Maven plugin provides this functionality, but there may be many developers do not pay attention to this feature, so this share to those who are not very clear about this feature, the configuration is simple, only need to tick windows-preferences-maven- Download Artifact Sources This option is available.

Gradle Modifying the Maven warehouse address

Recently migrating some projects to Android Studio, using the Gradle build is really a lot easier than the original ant. However, it is really painful to download the dependent speed at compile time.

If you can switch to a domestic MAVEN image warehouse, such as open source China's Maven library, or replace it with a self-built MAVEN, it must be excellent.

An easy way to modify the Build.gradle in the project root directory is to replace it with the following jcenter() mavenCentral() :

123)45   
allprojects {    repositories { maven{ url ‘http://maven.oschina.net/content/groups/public/‘} }}

But Jiabuzhu project more, difficult not to change each?

Naturally there is a convenient way, the following copy to the name of the init.gradle file, and save to the USER_HOME/.gradle/ folder.

123456789  
Allprojects{    Repositories{ DefRepository_url=' Http://maven.oschina.net/content/groups/public ' All{ArtifactrepositoryRepo- If(RepoinstanceofMavenartifactrepository){ DefUrl=Repo.Url.Tostring() If(Url.StartsWith(' Https://repo1.maven.org/maven2 ')||Urlstartswith ( ' https://jcenter.bintray.com/' { project. Logger. "Repository ${repo.url} replaced by $REPOSITORY _url."  remove repo } }} maven { url repository_url } }}     

init.gradleThe file is actually Gradle 初始化脚本 (initialization Scripts) and is the global configuration of the runtime.
For more detailed information, see http://gradle.org/docs/current/userguide/init_scripts.html

Gradle Modifying the Maven warehouse address

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.