0

I'm having a little trouble with AWS CodeBuild.. We are hosting the ibis adapter framework on Github (https://github.com/ibissource/mvn-repo) as a Maven repository.

I'm using the framework as a dependency for the project I'm working on. In my pom.xml file I set the version property and the repositories/dependencies.

When I run the Maven build locally it has no trouble finding the dependency (well it is giving warnings about not being able to transfer meta data) but it is able to build without any problems.

EDIT: It was able to build local because I had the files cached in my .m2 repository .. after renaming the folder I was able to reproduce the problem

When I commit my changes to CodeCommit and fire the CodePipeline, once it reaches CodeBuild it fails almost immediately with the following error:

ERROR] Failed to execute goal on project api: Could not resolve dependencies for project com.priooo:api:war:0.0.29: Failed to collect dependencies at org.ibissource:ibis-adapterframework-core:jar:7.0-B4-SNAPSHOT: Failed to read artifact descriptor for org.ibissource:ibis-adapterframework-core:jar:7.0-B4-SNAPSHOT: Could not transfer artifact org.ibissource:ibis-adapterframework-core:pom:7.0-B4-SNAPSHOT from/to ibis-mvn-repo (https://github.com/ibissource/mvn-repo/raw/master/releases): Received fatal alert: protocol_version -> [Help 1]

<properties>
     <iaf.version>7.0-RC3-SNAPSHOT</iaf.version>
</properties>

<repositories>
    <repository>
        <id>ibis-mvn-repo</id>
        <url>${ibissource.maven.repository.https}/releases</url>
    </repository>
    <repository>
        <id>ibis-mvn-repo-snapshots</id>
        <url>${ibissource.maven.repository.https}/snapshots</url>
    </repository>
</repositories>

and within dependencies I have the following

<dependency>
        <groupId>org.ibissource</groupId>
        <artifactId>ibis-adapterframework-core</artifactId>
        <version>${iaf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.ibissource</groupId>
        <artifactId>ibis-adapterframework-larva</artifactId>
        <version>${iaf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.ibissource</groupId>
        <artifactId>ibis-adapterframework-webapp</artifactId>
        <version>${iaf.version}</version>
        <type>war</type>
    </dependency>

SOLUTION

Seems that Maven doesn't like Github's redirection to the raw files. We've changed the Github URL to the raw URL and it seems to fix the problem

<ibissource.maven.repository.https>https://raw.githubusercontent.com/ibissource/mvn-repo/master</ibissource.maven.repository.https>
Laurens Mäkel
  • 815
  • 2
  • 12
  • 29

1 Answers1

4

When you use Maven with an AWS CodeBuild provided Java build environment, Maven pulls build and plugin dependencies from the secure central Maven repository at https://repo1.maven.org/maven2. This happens even if your build project's pom.xml file explicitly declares other locations to use instead.

You need to replace the settings.xml in the AWS Codebuild with your settings.xml.

version 0.2

phases:
  install:
    commands:
      - cp ./settings.xml /root/.m2/settings.xml

Ref: https://docs.aws.amazon.com/codebuild/latest/userguide/troubleshooting.html#troubleshooting-maven-repos

  • This does not seem to be the issue because building on AWS worked before without a custom settings.xml and the command in the buildspec.yml, all of the sudden it stopped working.. I've tried implementing a settings.xml with the edited .yml file.. – Laurens Mäkel Feb 26 '18 at 11:59
  • 2
    I've noted that AWS CodeBuild expects you "copy" in your mvn settings.xml file to overwrite the default provided... Given the build is associated with a single code repository.. Does this mean I need to have to duplicate the settings.xml for each of my code repositories (for each each Build Project)? What if I have 100s of code repositories? – OneMoreNerd Nov 13 '19 at 16:57
  • This is old, but for those who found this, my solution was to put a single `settings.xml` in S3, `wget` and done! – Oliver Dec 26 '21 at 05:30