Telenav / cactus

Modules for building the KivaKit Java framework.
Apache License 2.0
0 stars 1 forks source link

Cactus fails to build kivakit-component #16

Closed jonathanl-telenav closed 2 years ago

jonathanl-telenav commented 2 years ago

After removing all Telenav artifacts from .m2 repository:

mvn -f telenav-superpom/pom.xml clean install
mvn -Dcactus.scope=all -Dcactus.families= -Dmaven.javadoc.skip=true --threads 12 clean install

fails with:

[ERROR] Failed to execute goal on project mesakit-map-utilities-geohash: Could not resolve dependencies for project com.telenav.mesakit:mesakit-map-utilities-geohash:jar:0.9.17-SNAPSHOT: The following artifacts could not be resolved: com.telenav.kivakit:kivakit-component:jar:1.6.3-SNAPSHOT, com.telenav.kivakit:kivakit-data-compression:jar:1.6.3-SNAPSHOT, com.telenav.mesakit:mesakit-map-measurements:jar:0.9.17-SNAPSHOT: com.telenav.kivakit:kivakit-component:jar:1.6.3-SNAPSHOT was not found in https://s01.oss.sonatype.org/content/repositories/snapshots during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of ossrh has elapsed or updates are forced -> [Help 1]
timboudreau commented 2 years ago

TLDR: Your kivakit checkout is on the wrong branch, or it is behind a bunch of commits.

We have a handy script to avoid ever having this situation. It's called cactus-development-preparation and aliased as cdev.

To never have this problem again, here are some one-time-only steps:

  1. Make sure you have a ~/bin directory (or ~/local/.bin directory) in your PATH
  2. Pull and build cactus - right now, it should be 1.5.19 - cd cactus && git pull && mvn -Dmaven.test.skip.exec=true clean install
  3. To install the scripts, run: VERSION=1.5.19 mvn com.telenav.cactus:cactus-maven-plugin:${VERSION}:install-scripts
  4. If you want to use your current shell and have shell completion for the scripts, type rehash and press enter
  5. Run cdev and Cactus will make sure all your checkouts are on the develop (or publish for assets branches) branches and up to date

Thereafter, after a release or when you just want to be sure you're really up to date with the universe, just type cdev and poof. If you know there's a new version of cactus, simply run cactus-update-scripts to update your scripts.

If you've gotta, gotta, gotta put the scripts somewhere other than ~/bin or ~/.local/bin, then pass -Dcactus.script.destination=/path/to/some/writable/folder/on/the/path when you install them.

If you're morally opposed to installing the scripts for some reason, pull and build cactus first and then run this:

VERSION=1.5.19 mvn \
    -Dcactus.scope=all-project-families \
    -Dcactus.target-branch=develop \
    -Dcactus.update-root=true \
    -Dcactus.include-root=true \
    com.telenav.cactus:cactus-maven-plugin:${VERSION}:checkout

A few other things:

  1. --threads N with Maven is unreliable at best - sometimes it will race because it's trying build a thing that uses something which is still being built, sometimes it won't. I will summarily close build bugs that have not been reproduced without --threads.
  2. I don't know what -Dcactus.families= is intended to do there - best to get rid of it
  3. Same for -Dcactus.scope=all - maybe you meant all-project-families (all will add up to all-project-families but it's really only useful for operations like push and commit where you need them to apply to assets checkouts not just checkouts with a pom in the root)

For running vanilla mvn clean install, mvn clean install is plenty - at least at present, for run of the mill building of stuff, the cactus plugin is not in play other than generating build metadata, and those arguments aren't going to apply to that - that mojo just runs against whatever project it's told to.

I just built and encountered the exact same problem. The reason was that my checkout of kivakit was still on the release/current branch. Yours probably is too. So you're building a branch just for kivakit that is 1.6.2, but everything else expects 1.6.3-SNAPSHOT.

jonathanl-telenav commented 2 years ago

The bug reproduces on develop branch. The code is, in fact, updated. Try it.

jonathanl-telenav commented 2 years ago

Also, something tells me this giant comment doesn't belong in GitHub issues, but on some documentation page for cactus.

timboudreau commented 2 years ago

Did you do the steps described above?

timboudreau commented 2 years ago

Other things that could be going on:

This failure was cached in the local repository and resolution is not reattempted until the update interval of ossrh has elapsed or updates are forced

Kivakit has not been built locally - or was built locally, but the release branch not the develop branch.

You attempted to build Mesakit at least once where it failed, because kivakit 1.6.3-SNAPSHOT was not built locally. It then remembered that failure.

com.telenav.kivakit:kivakit-component:jar:1.6.3-SNAPSHOT is what it cannot find, and it is definitely in the tree. If you have the develop branch checked out and build it (rebuild superpoms for good measure too), mesakit will be fine. It just hasn't been built into your local repo and there are no published -SNAPSHOT versions.

jonathanl-telenav commented 2 years ago

yes, I did the steps above (the repro case). did you? you have to include this part to reproduce the bug:

"After removing all Telenav artifacts from .m2 repository"

none of your suggestions are relevant because of this.

jonathanl-telenav commented 2 years ago

Stop guessing and try the repro case.

jonathanl-telenav commented 2 years ago

This is looking like a maven bug. I can't seem to reproduce it without --threads 12