Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up maven.google.com with maven_aar #3633

Closed
TastyPi opened this issue Aug 28, 2017 · 2 comments
Closed

Setting up maven.google.com with maven_aar #3633

TastyPi opened this issue Aug 28, 2017 · 2 comments

Comments

@TastyPi
Copy link

TastyPi commented Aug 28, 2017

I can't seem to get maven.google.com working with maven_aar for the Android support libraries. Here's what I have so far:

WORKSPACE:

load("@bazel_tools//tools/build_defs/repo:maven_rules.bzl", "maven_aar")

maven_aar(
  name = "appcompat_v7",
  artifact = "com.android.support:appcompat_v7:26.0.1",
  settings = "google-maven.xml",
)

external/google-maven.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <profiles>
    <profile>
      <id>google</id>
      <repositories>
        <repository>
          <id>google</id>
          <name>Google</name>
          <snapshots>
            <enabled>true</enabled>
            <checksumPolicy>fail</checksumPolicy>
          </snapshots>
          <url>https://maven.google.com</url>
        </repository>
      </repositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>google</activeProfile>
  </activeProfiles>
</settings>

third_party/BUILD:

android_library(
    name = "appcompat_v7",
    exports = ["@appcompat_v7//aar"],
)

But if I depend on //third_party:appcompat_v7 I get the following error:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:get (default-cli) @ standalone-pom ---
[INFO] Resolving com.android.support:appcompat_v7:aar:26.0.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.072 s
[INFO] Finished at: 2017-08-28T22:25:55+01:00
[INFO] Final Memory: 13M/304M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:get (default-cli) on project standalone-pom: Couldn't download artifact: Failure to find com.android.support:appcompat_v7:aar:26.0.1 in https://maven.google.com was cached in the local repository, resolution will not be reattempted until the update interval of google has elapsed or updates are forced
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=com.android.support -DartifactId=appcompat_v7 -Dversion=26.0.1 -Dpackaging=aar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=com.android.support -DartifactId=appcompat_v7 -Dversion=26.0.1 -Dpackaging=aar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] 
[ERROR] com.android.support:appcompat_v7:aar:26.0.1
[ERROR] 
[ERROR] from the specified remote repositories:
[ERROR] google (https://maven.google.com, releases=true, snapshots=true),
[ERROR] central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)
[ERROR] -> [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/MojoExecutionException

+ mvn -s settings.xml org.apache.maven.plugins:maven-dependency-plugin:2.10:get -Dtransitive=false -Dartifact=com.android.support:appcompat_v7:26.0.1:aar

Failed to fetch Maven dependency and referenced by '//third_party:appcompat_v7'.

I'm assuming it's an issue with my Maven settings since I've never had to set up something like this before. Any help would be appreciated.

@aj-michael
Copy link
Contributor

You have a typo in the artifact name. It is "appcompat-v7", not "appcompat_v7".

@TastyPi
Copy link
Author

TastyPi commented Aug 28, 2017

Of course it was something simple like that. It works now, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants