Skip to content

Consume jnp-hipo4 4.5 from the hipo-java package registry - #1360

Open
mathieuouillon wants to merge 4 commits into
developmentfrom
feat/hipo-java-4.5
Open

Consume jnp-hipo4 4.5 from the hipo-java package registry#1360
mathieuouillon wants to merge 4 commits into
developmentfrom
feat/hipo-java-4.5

Conversation

@mathieuouillon

Copy link
Copy Markdown
Collaborator

jnp-hipo4 is now built and released from its own repository,
code.jlab.org/hallb/clas12/hipo-java,
rather than being cut from the monolithic jnp tree. This points the dependency
at 4.5 from that project's package registry.

<repository>
  <id>clas12-hipo-java</id>
  <url>https://code.jlab.org/api/v4/projects/919/packages/maven</url>
</repository>

The registry is public, so this needs no credentials or settings.xml.

Two things this changes beyond the coordinate

exp4j is governed by our pin again. The old clasweb artifact was a fat jar
bundling exp4j, lz4 and xxhash. The net.objecthunter:exp4j:0.4.8 pinned in
the root pom — specifically to resolve the jnp-hipo / jnp-hipo4 conflict, per
docs/dependency_conflicts.md — was therefore being shadowed by a copy inside the
jar. 4.5 publishes a plain jar and declares its dependencies normally:

\- org.jlab.jnp:jnp-hipo4:jar:4.5:compile
   +- net.objecthunter:exp4j:jar:0.4.8:compile
   \- org.lz4:lz4-java:jar:1.8.0:compile

maven-enforcer's DependencyConvergence passes.

Fewer duplicate classes on the classpath. The fat jar also carried
org.jlab.jnp.{matrix,ascii,readers} and MigLayout, all of which jnp-hipo
already provides — so they were present twice and classpath order decided the
winner. 4.5 drops them. Every one this project actually imports (17
org.jlab.jnp.matrix, 17 org.jlab.jnp.utils.*) resolves from jnp-hipo, which
we already depend on. net.miginfocom, org.jlab.jnp.ascii and
org.jlab.jnp.readers have zero imports here.

No org.jlab.jnp.hipo4 class is missing in 4.5 — the API surface is complete.

Verification

Compared against an unmodified development baseline, same commands:

baseline 4.3-SNAPSHOT this branch (4.5)
build 49 modules SUCCESS 49 modules SUCCESS
compiled 1620 source files → 2014 classes, 52 jars
tests 14 run, 0 failures, 1 error 14 run, 0 failures, 1 error
the error DCReconstructionTest DCReconstructionTest — same test, same cause

That error is FileNotFoundException: TORUS map not found at ../../etc/data/magfield/Symm_torus_r2501_phi16_z251_24Apr2018.dat (the NPE is its
downstream effect) — a field map absent from a fresh clone. It reproduces
identically without this change
, which is the only reason it can be set aside.

Notes for reviewers

  • If you fetched jnp-hipo4:4.5 before 2026-07-25 09:19 UTC you may have a
    cached fat jar from a packaging bug in the first upload (the assembly was
    deployed as the main artifact). It has been corrected and re-published. Clear
    ~/.m2/repository/org/jlab/jnp/jnp-hipo4/4.5 if the tree looks wrong; a correct
    main jar is 127 classes with no net/* packages.
  • Pre-existing and not addressed here: 48 classes still overlap between
    jnp-hipo and jnp-hipo4 (org.jlab.jnp.utils.{json,file,data,…}), since
    hipo-java ships its own copies. The old jar duplicated them too, so this is not
    a regression — but classpath order still decides which JsonObject wins.
    Removing that overlap means hipo-java dropping org/jlab/jnp/utils in favour of
    depending on jnp-hipo, which is a larger decision than this PR.

Comment thread pom.xml Outdated

@c-dilks c-dilks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thank you so much for doing this!

@mathieuouillon

Copy link
Copy Markdown
Collaborator Author

I tested both halves of the concern, clearing the local ~/.m2
entry each time so nothing was answering from cache.

The entry is load-bearing. Drop it and the build fails outright:

[ERROR] Could not find artifact org.jlab.jnp:jnp-hipo4:jar:4.5
        in clas12maven (https://clasweb.jlab.org/.clas12maven)

after walking clas12maven → jnp-maven → central. So 4.5 exists nowhere but
project 919 today, and the shadowing risk is prospective rather than current —
clasweb only carries the older fat-jar versions.

Order really does decide, and silently. I put a deliberately fake
org.jlab.jnp:jnp-hipo4:4.5 (a 211-byte jar with a marker file) in a file://
repo and varied only its position, resolving into a throwaway local repo:

listed first resolved
the impostor the impostor — 211 bytes
clas12-hipo-java the real jar — 310,609 bytes

When the impostor won, Maven emitted nothing at all: no warning, no
conflict notice, exit 0. That is the case listing this repository first
prevents, and it would not have announced itself.

jnp-hipo4 is now built and released from its own repository,
code.jlab.org/hallb/clas12/hipo-java, instead of being cut from the monolithic
jnp tree. Points the dependency at 4.5 from that project's package registry,
which is public and needs no credentials.

Two things this changes beyond the coordinate. The old clasweb artifact was a fat
jar bundling exp4j, lz4 and xxhash, so the exp4j 0.4.8 pinned here to resolve the
jnp-hipo/jnp-hipo4 conflict was being shadowed by a bundled copy; 4.5 publishes a
plain jar and declares exp4j and lz4-java as ordinary dependencies, so that pin
governs again. It also drops the classes the fat jar duplicated with jnp-hipo
(matrix, ascii, readers, MigLayout) -- all still supplied by jnp-hipo, which this
project already depends on, and the ones this project actually imports come from
there.

Verified against an unmodified development baseline: 49 modules build, 1620
source files compile, and the test suite is identical -- 14 run, 0 failures, and
the same single DCReconstructionTest error, which is the absent TORUS field map
and reproduces without this change. maven-enforcer's DependencyConvergence passes.
Maven queries repositories in declaration order and takes the first that
answers with the coordinate, so whichever comes first *decides* what
`org.jlab.jnp:jnp-hipo4` resolves to. The clasweb repositories still carry the
old fat-jar `jnp-hipo4`; with them ahead of this entry, either one serving a
4.5 would shadow the artifact this project means to consume, and nothing would
report it.

Verified rather than assumed. The effective POM now orders them
clas12-hipo-java, clas12maven, jnp-maven, central. With the local cache entry
removed, `jnp-hipo4:4.5` is downloaded from clas12-hipo-java.

The trade-off is real and is written into the comment: code.jlab.org is asked
first for every artifact and misses on all but `jnp-hipo4`. Resolving
`org.json:json` walks clas12-hipo-java, clas12maven, jnp-maven, then central,
which serves it. Note the miss is silent at default verbosity — Maven logs no
404, it just tries the next repository — so the cost is latency and a stall
when that host is unwell, not visible errors. It goes away if a real repository
manager ever proxies these.
Removed lengthy comments about repository configuration and updated the repository entry for `clas12-hipo-java`.
Removed unnecessary comment syntax from pom.xml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants