bazel-contrib / bazel-contrib/rules_jvm_external

Setting version of java_export() jar via command line flag

Open
#618 1 comment 7 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
373
Forks
301
Avg merge
7d 17h
Merged PRs (30d)
3

Description

Is there a way to set the version number of the published jar on the command line? If I use an environment variable in the maven_coordinates, it almost works, but it's not substituted in the pom template. I can create my own pom template and do the string replacement via `--define=` but then I need to set the version in two places. Once by exporting the variable for its use in `maven_coordinates` and again in a `--define=maven_version=0.0.0`. Is there a better way to set the version once on the command line and get it applied to the `maven_coordinates` and the pom file? I've seen a lot of projects using a jenkins build number as part of the published jar version.

```py
java_export(
name = "export",
maven_coordinates = "group:pkg:$MAVEN_VERSION",
)
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing the java_export() entry point and how maven_coordinates and the POM template receive values. Check whether one command-line version can be propagated to both locations, and verify that the published JAR coordinates and generated POM use the same version.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.