Building and packaging RPM Java Maven project with fedpkg and missing dependencies

Hello,

I am trying to build a Java project, and I uses Maven to manage the (java) package dependencies. I use fedpkg, as my goal is, someday, to publish it on Fedora Copr as a RPM package.

The project builds fine with Maven, but I am quickly stuck once I start with my specfile.

I am following the Java Packaging HOWTO, and I encountered the problem of missing dependencies.
This is a Maven error I get while executing ‘fedpkg --release f39 mockbuild --enable-network’

[ERROR] Failed to execute goal on project morganaxproc-iiise:
Could not resolve dependencies for project com.xml_project:morganaxproc-iiise:jar:1.4.1-SNAPSHOT:
The following artifacts could not be resolved:
co.paralleluniverse:quasar-core:jar:0.7.9 (absent),
nu.validator:htmlparser:jar:1.4.15 (absent),
co.paralleluniverse:quasar-actors:jar:0.7.9 (absent),
org.xmlresolver:xmlresolver:jar:4.5.1 (absent),
net.sf.saxon:Saxon-HE:jar:12.3 (absent),
com.networknt:json-schema-validator:jar:1.0.79 (absent),
org.relaxng:jing:jar:20220510 (absent),
de.bottlecaps:markup-blitz:jar:1.4 (absent),
org.nineml:coffeefilter:jar:3.2.6 (absent),
org.nineml:coffeegrinder:jar:3.2.6 (absent)
Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact co.paralleluniverse:quasar-core:jar:0.7.9 has not been downloaded from it before. -> [Help 1]

From what I understood, Fedora has some kind of ‘shadowing’ mechanism, with which Maven packages are mirrored inside Fedora’s build infrastructure, so builds can run independently from Maven: Maven packages have virtual provides in a format mvn(artifact coordinates)

So I added:

BuildRequires: mvn(commons-codec:commons-codec)
BuildRequires: mvn(co.paralleluniverse:quasar-core)
BuildRequires: mvn(nu.validator:htmlparser)
BuildRequires: mvn(co.paralleluniverse:quasar-actors)
BuildRequires: mvn(org.xmlresolver:xmlresolver)
BuildRequires: mvn(org.apache.httpcomponents:httpcore)
BuildRequires: mvn(org.apache.httpcomponents:httpclient)
BuildRequires: mvn(com.sun.mail:javax.mail)
BuildRequires: mvn(net.sf.saxon:Saxon-HE)
BuildRequires: mvn(com.fasterxml.jackson.core:jackson-databind)
BuildRequires: mvn(com.networknt:json-schema-validator)
BuildRequires: mvn(org.relaxng:jing)
BuildRequires: mvn(de.bottlecaps:markup-blitz)
BuildRequires: mvn(org.nineml:coffeefilter)
BuildRequires: mvn(org.nineml:coffeegrinder)

One ‘BuildRequires’ for each package.
After restarting the build, the result is better, but some packages are missing:

No matching package to install: 'mvn(co.paralleluniverse:quasar-actors)'
No matching package to install: 'mvn(co.paralleluniverse:quasar-core)'
No matching package to install: 'mvn(com.networknt:json-schema-validator)'
No matching package to install: 'mvn(de.bottlecaps:markup-blitz)'
No matching package to install: 'mvn(net.sf.saxon:Saxon-HE)'
No matching package to install: 'mvn(nu.validator:htmlparser)'
No matching package to install: 'mvn(org.nineml:coffeefilter)'
No matching package to install: 'mvn(org.nineml:coffeegrinder)'
No matching package to install: 'mvn(org.relaxng:jing)'
No matching package to install: 'mvn(org.xmlresolver:xmlresolver)'
Not all dependencies satisfied

Now, what should I do with that?

  • Is it possible and wise to ask for these packages to be available as virtual provide?
  • Any other ideas that I missed from the documentation?

Now that I posted, I see related posts that I didn’t find before :smile:.

In one of them, someone who answers says that if the library needed is not yet packaged, one has to package it separately.
I guess that answers my question?

That is correct, you will have to package the dependencies first. Some of them have been in Fedora before, but have since been retired: