googleapis / googleapis/release-please

Need Guidance on maven-workspace setup

Open
#1,999 3 comments 1 reaction 1 assignee Claimed by @chingor13 View on GitHub
priority: p3 type: question
Dominant language
TypeScript
Stars
7.5k
Forks
588
Avg merge
12h 16m
Merged PRs (30d)
7

Description

### What you're trying to do
I have a maven mono repo with a root level `pom` artifact that defines common dependencies and configuration; and, child modules that has their own `pom.xml`. The directory tree looks something like this
```
.
├── CHANGELOG.md
├── COPYRIGHT
├── README.md
├── app-1
│ ├── CHANGELOG.md
│ ├── pom.xml
│ ├── src
│ └── target
├── app-2
│ ├── CHANGELOG.md
│ ├── pom.xml
│ ├── src
│ └── target
├── app-2
│ ├── CHANGELOG.md
│ ├── pom.xml
│ ├── src
│ └── target
├── app-3
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── pom.xml
│ ├── src
│ └── target
├── pom.xml
├── versions.txt
```
I want to be able to update packages that are dependent whenever I make a change to a module. And only update everything if root `pom.xml` is changed. However, I'm having trouble achieving this with the current manifest setup.

### What code you've already tried
here is my manifest:
```json
{
"app-1": "0.2.6",
"app-2": "0.2.6",
"app-2": "0.2.6",
".": "0.2.9"
}
```
and my config:
```json
{
"bootstrap-sha": "cf1de436369068f5a41ba8f3a3587a545917ebe3",
"changelog-path": "CHANGELOG.md",
"include-component-in-tag": true,
"skip-snapshot": true,
"packages": {
"app-1": {
"component": "org-app-1" #artifiact name in pom
},
"app-2": {
"component": "org-app-2"
},
"app-3": {
"component": "org-app-3"
},
".": {
"component": "fs-app-parent",
"release-type": "java-yoshi", # without this I wan't able to update the parent version in module pom.xml
"extra-files": [
{
"type": "pom",
"path": "app-1/pom.xml"
},
{
"type": "pom",
"path": "app-2/pom.xml"
},
{
"type": "pom",
"path": "app-3/pom.xml"
}
]

}
},
"skip-github-release": false,
"release-type": "maven",
"plugins": [
"maven-workspace"
],
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}
```
my child pom's has an annotation to be detected by `java-yoshi` to update the parent version like so:
```xml

io.org.app
org-app-parent
0.2.10-SNAPSHOT
../pom.xml

```
and finally my `versions.txt`
```
org-app-parent:0.2.9:0.2.10-SNAPSHOT
```
Every time I have a PR with changes to a module, the dependencies are correctly determined when I run `release-plesae` in cli with `--target-branch` pointed to my feature branch. However when this PR is merged, all the poms are updated due to release please bumping the parent pom version. Github releases are only created for parent and the module that was changed _not_ its consumers

My ultimate goal is:
1. on feature pr merge to main, release please determines the correct dependencies to update and the sem ver based on commit and opens a releasse PR
2. Upon merging that release PR tagged releases are created in github
3. On github release I can run `mvn deploy` to deploy the artifact (to either artifactory or docker registry)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.