all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Phil Beadling <phil@beadling.co.uk>
To: Guix Devel <guix-devel@gnu.org>
Subject: Maven Build System Dependency Issue
Date: Tue, 8 Feb 2022 15:27:14 +0000	[thread overview]
Message-ID: <CAOvsyQszDp3S2-h5=cM=XqevvjFGceDD4C+NyCMujfF9=QAetA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 7375 bytes --]

Hi Guixers,

First let me say I'm a Maven novice, so it's possible I'm doing something
dumb on the Maven side of things.

I'm unable to make a bare-bones Maven project build in Guix.

This looks to be a problem with mismatched dependencies in Guix around
java-commons-codec.

I suggest what probably needs to be fixed upstream below (assuming my hunch
is correct!).

However I'm looking for advice on how to workaround this problem today to
get a basic Maven package building.

*My method:*

Following advice here:
https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

Using an environment like so:
guix environment --ad-hoc maven

I create a new git repo and put this in the root (so pom.xml, etc, sit in
in the root of the repo)

mvn archetype:generate -DgroupId=com.quantile.app
-DartifactId=java-test-repo
-DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4
-DinteractiveMode=false



I'm able to package and run everything OK (obviously the dependencies are
being pulled from the web in this case):
mvn package
java -cp target/java-test-repo-1.0-SNAPSHOT.jar com.quantile.app.App

Next I try to create a bare-bones Guix package to build this (this time
there will be no web access during the build):

(define-public java-test-repo-integration
  (let ((commit-integration "b9e3894aa3629fc2d60ceadea2f655d4cb6a826b"))
    (package
      (name "java-test-repo")
      (version integration-version)
      (source
       (git-checkout
        (url "ssh://git@vcs:1234/ea/java-test-repo.git")
        (commit commit-integration)))
      (build-system maven-build-system)
      (home-page "https://vcs/projects/EA/repos/java-test-repo/browse")
      (synopsis "Java Test Repo Production")
      (description "Java/Maven bare-bones framework for testing")
      (license license-quantile))))

I get the following build failure:

[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time:  1.136 s
[INFO] Finished at: 2022-02-08T14:39:36Z
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test)
on project java-test-repo: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed: Plugin
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4 or one of its
dependencies could not be resolved: Failed to collect dependencies at
org.apache.maven.plugins:maven-surefire-plugin:jar:3.0.0-M4 ->
org.apache.maven.surefire:maven-surefire-common:jar:3.0.0-M4 ->
org.apache.maven.surefire:surefire-api:jar:3.0.0-M4 ->
*commons-codec:commons-codec:jar:1.15:
Failed to read artifact descriptor for
commons-codec:commons-codec:jar:1.15: *Cannot access central (
https://repo.maven.apache.org/maven2) in offline mode and the artifact
org.apache.commons:commons-parent:pom:52 has not been downloaded from it
before. -> [Help 1]


After doing some digging I think I know why:

$ guix show java-commons-codec

name: java-commons-codec

version: 1.15

outputs: out

systems: x86_64-linux i686-linux

dependencies: *apache-commons-parent-pom@50* java-commons-lang3@3.9
java-junit@4.12


So it's packaged with a propagated apache-commons-parent-pom at version 50.


See also here for package definition:

https://github.com/guix-mirror/guix/blob/9fe48723c8266ffe8e6a639be2ec2e362cf20cb5/gnu/packages/java.scm#L7671here


But if I look at the POM in the Gnu Store - it is showing version 52 for
the commons-parent which I am assuming (perhaps incorrectly?) should match
the version 50 above?


/gnu/store/7qgi821xidn9nbb07qw35g7wmgv84jln-java-commons-codec-1.15/lib/m2/./commons-codec/commons-codec/1.15/commons-codec-1.15.pom



  <parent>

    <groupId>org.apache.commons</groupId>

    <artifactId>commons-parent</artifactId>

    <version>*52*</version>

  </parent>


Likewise if I look at the source code on Apache's website - it's 52 too:

https://dlcdn.apache.org//commons/codec/source/commons-codec-1.15-src.tar.gz
<https://dlcdn.apache.org/commons/codec/source/commons-codec-1.15-src.tar.gz>



  <parent>

    <groupId>org.apache.commons</groupId>

    <artifactId>commons-parent</artifactId>

    <version>*52*</version>

  </parent>


What I think has happened is that java-commons-codec has been promoted from
version 1.14 to version 1.15 without changing the propoagated input?

On version 1.14 everything would match:

https://archive.apache.org/dist/commons/codec/source/commons-codec-1.14-src.tar.gz

  <parent>

    <groupId>org.apache.commons</groupId>

    <artifactId>commons-parent</artifactId>

    <version>50</version>

  </parent>

*So assuming this isn't going to cause an avalanche of other issues the
solution proper seems to be either downgrade java-common-codec to version
1.14, or upgrade the dependency on apache-commons-parent-pom to 52?*

What I'm looking for today is any workaround which allows me to use Maven
without having to wait to for upstream fix.

My first attempt was to try - adding an inherited package and then swapping
this in place of 1.15:

(define-public java-commons-codec-old
  (package
    (inherit java-commons-codec)
    (version "1.14")))

guix build -L /home/foo/git/guix-packages/packages
--with-input=java-commons-codec=java-commons-codec@1.14 java-test-repo

This seems to just go round in circles never building and throwing Java
exceptions?


I also tried manually patching the whole dependency tree, but I think I've
introduced the same package more than once attempting this as I get symlink
errors:


(define-public java-commons-codec-old
  (package
    (inherit java-commons-codec)
    (version "1.14")))

(define-public java-surefire-api-old
  (package
    (inherit java-surefire-api)
    (propagated-inputs
     `(("java-commons-codec" ,java-commons-codec-old)
       ,@(alist-delete "java-commons-codec" (package-propagated-inputs
java-surefire-api))))))

(define-public maven-surefire-common-old
  (package
    (inherit maven-surefire-common)
    (propagated-inputs
     `(("java-surefire-api" ,java-surefire-api-old)
       ,@(alist-delete "java-surefire-api" (package-propagated-inputs
maven-surefire-common))))))

(define-public maven-surefire-plugin-old
  (package
    (inherit maven-surefire-plugin)
    (propagated-inputs
     `(("maven-surefire-common" ,maven-surefire-common-old)
       ,@(alist-delete "maven-surefire-common" (package-propagated-inputs
maven-surefire-plugin))))))

(define-public java-test-repo-integration
  (let ((commit-integration "b9e3894aa3629fc2d60ceadea2f655d4cb6a826b"))
    (package
      (name "java-test-repo")
      (version integration-version)
      (source
       (git-checkout
        (url "ssh://git@vcs:1234/ea/java-test-repo.git")
        (commit commit-integration)))
      (build-system maven-build-system)


*      (arguments `(#:maven-plugins
 (("maven-surefire-plugin" ,maven-surefire-plugin-old)
,@(alist-delete "maven-surefire-plugin" (default-maven-plugins)))))*
      (home-page "https://vcs/projects/EA/repos/java-test-repo/browse")
      (synopsis "Java Test Repo Production")
      (description "Java/Maven bare-bones framework for testing")
      (license license-quantile))))



Any ideas greatfuly received!

[-- Attachment #2: Type: text/html, Size: 24900 bytes --]

             reply	other threads:[~2022-02-08 16:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 15:27 Phil Beadling [this message]
2022-02-08 20:19 ` Maven Build System Dependency Issue Julien Lepiller
2022-02-09 12:23   ` Phil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOvsyQszDp3S2-h5=cM=XqevvjFGceDD4C+NyCMujfF9=QAetA@mail.gmail.com' \
    --to=phil@beadling.co.uk \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.