Recent Core Build Fails

Hi,

I’m getting an error trying to build the Map Matching recent core branch. The master branches builds OK but I’m trying to build a version with the recent update to fix the bike routing issue on bridleways.

I’m running the following build command:

mvn package -DskipTests clean install

and I’m getting the following error:

[ERROR] Failed to execute goal on project graphhopper-map-matching-core: Could n
ot resolve dependencies for project com.graphhopper:graphhopper-map-matching-cor
e:jar:2.0-SNAPSHOT: Failed to collect dependencies at com.graphhopper:graphhoppe
r-reader-osm:jar:4da82d9226e1ff9c5525fa3936204c7effc2fc8a: Failed to read artifa
ct descriptor for com.graphhopper:graphhopper-reader-osm:jar:4da82d9226e1ff9c552
5fa3936204c7effc2fc8a: Could not transfer artifact com.graphhopper:graphhopper-r
eader-osm:pom:4da82d9226e1ff9c5525fa3936204c7effc2fc8a from/to github (https://m
aven.pkg.github.com/graphhopper/graphhopper): Authentication failed for https://
maven.pkg.github.com/graphhopper/graphhopper/com/graphhopper/graphhopper-reader-
osm/4da82d9226e1ff9c5525fa3936204c7effc2fc8a/graphhopper-reader-osm-4da82d9226e1
ff9c5525fa3936204c7effc2fc8a.pom 401 Unauthorized -> [Help 1]

Any ideas what I need to do to get this working?

You need to let maven know your github credentials to access the GH core jar (which is a temporary release into github packages).

See e.g. https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-apache-maven-for-use-with-github-packages

For bigger releases this is not necessary as we deploy them also to maven central.

Thanks, I’ve spent several hours trying to figure out how to add the GitHub credentials but it’s still not working so maybe I’ve not done it correctly!

I’ve created an SSH key/passphrase in GitHub and added this to the maven settings.xml file as per the link you gave. The GitHub SSH connection works (tested as per https://docs.github.com/en/github/authenticating-to-github/testing-your-ssh-connection) but I still get the same error when I try to do the build.

I wasn’t sure what to put in the repositories section of the maven settings file, so maybe this is the issue. I put the following:

  <repositories>
    <repository>
      <id>com.graphhopper</id>
      <name>com.graphhopper</name>
      <url>https://mvnrepository.com/artifact/com.graphhopper</url>
      <layout>default</layout>
      <snapshotPolicy>always</snapshotPolicy>	  
    </repository>
  </repositories> 

Any other suggestions?

This is my cat ~/.m2/settings.xml:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <activeProfiles>
    <activeProfile>github</activeProfile>
  </activeProfiles>

  <profiles>
    <profile>
      <id>github</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>https://repo1.maven.org/maven2</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
        <repository>
          <id>github</id>
          <name>GitHub GraphHopper Apache Maven Packages</name>
          <url>https://maven.pkg.github.com/graphhopper/graphhopper</url>
        </repository>
      </repositories>
    </profile>
  </profiles>                                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                              
  <servers>                                                                                                                                                                                                                                                                   
    <!-- github packages needs a personal access token from *any* account even to read public packages... -->                                                                                                                                                                 
    <server>                                                                                                                                                                                                                                                                  
      <id>github</id>                                                                                                                                                                                                                                                         
      <username>my_user_name</username>                                                                                                                                                                                                                                             
      <password>my_password</password>                                                                                                                                                                                                           
    </server>                                                                                                                                                                                                                                                                 
  </servers>                                                                                                                                                                                                                                                                  
</settings>  

Thanks for sharing that. I’ve replaced my settings.xml with your one putting in my GitHub username and password but the build still fails. I don’t get the 401 Unauthorized error now but instead get a Bad Request error:

[ERROR] Failed to execute goal on project graphhopper-map-matching-core: Could n
ot resolve dependencies for project com.graphhopper:graphhopper-map-matching-cor
e:jar:2.0-SNAPSHOT: Failed to collect dependencies at com.graphhopper:graphhoppe
r-reader-osm:jar:4da82d9226e1ff9c5525fa3936204c7effc2fc8a: Failed to read artifa
ct descriptor for com.graphhopper:graphhopper-reader-osm:jar:4da82d9226e1ff9c552
5fa3936204c7effc2fc8a: Could not transfer artifact com.graphhopper:graphhopper-r
eader-osm:pom:4da82d9226e1ff9c5525fa3936204c7effc2fc8a from/to github (https://m
aven.pkg.github.com/graphhopper/graphhopper): Transfer failed for https://maven.
pkg.github.com/graphhopper/graphhopper/com/graphhopper/graphhopper-reader-osm/4d
a82d9226e1ff9c5525fa3936204c7effc2fc8a/graphhopper-reader-osm-4da82d9226e1ff9c55
25fa3936204c7effc2fc8a.pom 400 Bad Request -> [Help 1]

Hm this is strange maybe just try again. For example I can download the .pom file for which the request failed via my browser even: https://maven.pkg.github.com/graphhopper/graphhopper/com/graphhopper/graphhopper-reader-osm/4da82d9226e1ff9c5525fa3936204c7effc2fc8a/graphhopper-reader-osm-4da82d9226e1ff9c5525fa3936204c7effc2fc8a.pom

(for me it does not work without a login+password. does it work for you in a private window?)

ah no not in a private window. and otherwie I get <Code>AccessDenied</Code> <Message>Request has expired</Message> now, but it worked before…

Success! I tried accessing the .pom file in the browser as suggested. It asked for my login details which I entered, then I got the following message:

Unable to download maven package : "graphql call failed: Your token has not been granted the required scopes to execute this query. The ‘id’ field requires one of the following scopes: [‘read:packages’], but your token has only been granted the: [’’] scopes. Please modify your token’s scopes at: https://github.com/settings/tokens."

So, I went to the tokens link provided and set up a Personal Access Token with read packages permissions. I then replaced my password with the Personal Access Token in the settings.xml file and ran the build command again. This time it worked! Thanks for your help. Hopefully my experience will be useful to others.

1 Like
Powered by Discourse