0

I am trying to deploy a spring cloud function which has a dependency from a private GitLab maven repo. In spite, of giving the token in settings.xml, the spring cloud function build fails with below error :

Build failed: [INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for io.spring.sample:function-sample:jar:2.0.0.RELEASE
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-deploy-plugin is missing. @ line 82, column 12
[WARNING] 'build.plugins.plugin.version' for org.springframework.boot:spring-boot-maven-plugin is missing. @ line 89, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------< io.spring.sample:function-sample >------------------
[INFO] Building function-sample 2.0.0.RELEASE
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Downloading from gitlab-maven: https://gitlab.com/<path-to-git-depencency>
[INFO] Downloading from gitlab-maven: https://gitlab.com/<path-to-git-depencency>
[WARNING] The POM for <library> is missing, no dependency information available
[INFO] Downloading from gitlab-maven: https://gitlab.com/<path-to-git-depencency>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.738 s
[INFO] Finished at: 2020-08-25T13:04:06Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project function-sample: Could not resolve dependencies for project io.spring.sample:function-sample:jar:2.0.0.RELEASE: Could not find artifact <library name>in gitlab-maven (<path-to-git-depencency>) -> [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/DependencyResolutionException; Error ID: efa79f31

Settings.xml

<settings xmlns="http://maven.apache.org/POM/4.0.0"

 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

 <servers>

 <server>

 <id>gitlab-maven</id>

 <configuration>

 <httpHeaders>

 <property>

 <name>Private-Token</name>

 <value>xxxx</value>

 </property>

 </httpHeaders>

 </configuration>

 </server>

 </servers>

 </settings>

POM.xml

    <repository>

 <id>gitlab-maven</id>

 <url><gitlab-path></url>

 </repository>

 <repository>

 <snapshots>

 <enabled>true</enabled>

 </snapshots>

 <id>central</id>

 <name>central</name>

 <url>https://repo.maven.apache.org/maven2/

 </repository>

The same code is working in local as well as GKE clusters. I am not able to debug. Is there a way to run maven command inside the cloud function to check the errors?

Arvind Sharma
  • 91
  • 1
  • 7
  • Why not clone the private repo to the app folder? May need to add a pre-process step in CI/CD to keep it up to date. – Josan Aug 25 '20 at 15:40
  • Maybe you can try using [gcloud](https://cloud.google.com/functions/docs/first-java#deploying_the_function) to deploy in addition to a gcloud wide [--verbosity=debug flag](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#GCLOUD-WIDE-FLAGS) – Andres S Aug 25 '20 at 21:40
  • @Josan this is as per the requirement need the lib in private repo so that it is accessible to others – Arvind Sharma Aug 26 '20 at 06:40
  • I want to update the snapshots before deploying the cloud function. How can I do that ? – Arvind Sharma Aug 26 '20 at 07:05
  • While deploying the cloud function, the cloud function is not picking up the latest snapshot version. If there is any way to mention that this while deploying the cloud function I believe the issue will get resolved. If someone has any idea regarding this please let me know – Arvind Sharma Aug 26 '20 at 07:31

0 Answers0