buildscript { ScriptHandler scriptHandler ->
scriptHandler.repositories { RepositoryHandler repositoryHandler ->
repositoryHandler.jcenter()
repositoryHandler.mavenCentral()
// 写法1
repositoryHandler.maven { MavenArtifactRepository mavenArtifactRepository ->
mavenArtifactRepository.setUrl("xxxxUrl")
mavenArtifactRepository.setName("name")
mavenArtifactRepository.credentials { PasswordCredentials passwordCredentials ->
passwordCredentials.setPassword("password")
passwordCredentials.setUsername("userName")
}
}
// 写法2
repositoryHandler.maven {
url 'xxxxUrl'
name "name"
credentials {
password "password"
userName "userName"
}
}
}
scriptHandler.dependencies {
}
}
写法1和写法2为什么是等价的?