Parse src/main/webapp resources for WAR projects#1103
Merged
Conversation
For WAR-packaged Maven projects, the src/main/webapp directory contains web application resources like web.xml. These files were not being parsed by MavenMojoProjectParser, which meant they didn't receive the JavaProject marker. This caused recipes like WebXmlToWebApplicationInitializer to skip them because they check for the JavaProject marker to determine the target project context. The fix adds webapp directory parsing after standard Maven resources are processed, but only for projects with packaging="war". Fixes moderneinc/customer-requests#1760
Member
|
Nice find! Good to finally understand why were were not seeing these changes. |
mergify bot
added a commit
to robfrank/linklift
that referenced
this pull request
Feb 14, 2026
… 6.28.0 to 6.29.0 [skip ci] Bumps [org.openrewrite.maven:rewrite-maven-plugin](https://github.com/openrewrite/rewrite-maven-plugin) from 6.28.0 to 6.29.0. Release notes *Sourced from [org.openrewrite.maven:rewrite-maven-plugin's releases](https://github.com/openrewrite/rewrite-maven-plugin/releases).* > 6.29.0 > ------ > > What's Changed > -------------- > > * Skip unresolved property placeholders when determining charset by [`@timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-maven-plugin#1105](https://redirect.github.com/openrewrite/rewrite-maven-plugin/pull/1105) > * chore(ci): bump org.apache.maven.plugins:maven-compiler-plugin from 3.14.1 to 3.15.0 by [`@dependabot`](https://github.com/dependabot)[bot] in [openrewrite/rewrite-maven-plugin#1106](https://redirect.github.com/openrewrite/rewrite-maven-plugin/pull/1106) > > **Full Changelog**: <openrewrite/rewrite-maven-plugin@v6.28.1...v6.29.0> > > 6.28.1 > ------ > > What's Changed > -------------- > > * chore(ci): bump org.assertj:assertj-bom from 3.27.6 to 3.27.7 by [`@dependabot`](https://github.com/dependabot)[bot] in [openrewrite/rewrite-maven-plugin#1101](https://redirect.github.com/openrewrite/rewrite-maven-plugin/pull/1101) > * chore(ci): bump org.codehaus.plexus:plexus-xml from 4.1.0 to 4.1.1 by [`@dependabot`](https://github.com/dependabot)[bot] in [openrewrite/rewrite-maven-plugin#1102](https://redirect.github.com/openrewrite/rewrite-maven-plugin/pull/1102) > * Parse src/main/webapp resources for WAR projects by [`@Jenson3210`](https://github.com/Jenson3210) in [openrewrite/rewrite-maven-plugin#1103](https://redirect.github.com/openrewrite/rewrite-maven-plugin/pull/1103) > > New Contributors > ---------------- > > * [`@Jenson3210`](https://github.com/Jenson3210) made their first contribution in [openrewrite/rewrite-maven-plugin#1103](https://redirect.github.com/openrewrite/rewrite-maven-plugin/pull/1103) > > **Full Changelog**: <openrewrite/rewrite-maven-plugin@v6.28.0...v6.28.1> Commits * [`b4c30ba`](openrewrite/rewrite-maven-plugin@b4c30ba) [maven-release-plugin] prepare release v6.29.0 * [`184e927`](openrewrite/rewrite-maven-plugin@184e927) Bump rewrite.version property * [`2c01af1`](openrewrite/rewrite-maven-plugin@2c01af1) OpenRewrite recipe best practices * [`d2ec8a7`](openrewrite/rewrite-maven-plugin@d2ec8a7) Delete files * [`5abd366`](openrewrite/rewrite-maven-plugin@5abd366) chore(ci): bump org.apache.maven.plugins:maven-compiler-plugin ([#1106](https://redirect.github.com/openrewrite/rewrite-maven-plugin/issues/1106)) * [`9792e32`](openrewrite/rewrite-maven-plugin@9792e32) Skip unresolved property placeholders when determining charset ([#1105](https://redirect.github.com/openrewrite/rewrite-maven-plugin/issues/1105)) * [`27684e2`](openrewrite/rewrite-maven-plugin@27684e2) Bump rewrite.version property * [`a36a35d`](openrewrite/rewrite-maven-plugin@a36a35d) [maven-release-plugin] prepare for next development iteration * [`01f3b70`](openrewrite/rewrite-maven-plugin@01f3b70) [maven-release-plugin] prepare release v6.28.1 * [`d1936af`](openrewrite/rewrite-maven-plugin@d1936af) Bump rewrite.version property * Additional commits viewable in [compare view](openrewrite/rewrite-maven-plugin@v6.28.0...v6.29.0) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/main/webappdirectory for projects with WAR packagingJavaProjectmarker from the project's provenanceProblem
When building LSTs for Maven WAR projects, files in
src/main/webapp(likeweb.xml) were not receiving theJavaProjectmarker. This caused recipes likeWebXmlToWebApplicationInitializerto skip these files because they check forJavaProjectto determine the target project context.The root cause:
MavenMojoProjectParseronly parsed resources frommavenProject.getResources()(standard Maven resource directories likesrc/main/resources), butsrc/main/webappis not a standard Maven resource directory - it's a special directory for WAR packaging.Solution
After parsing standard Maven resources, check if the project has WAR packaging. If so, also parse
src/main/webappusing the sameOmniParser. These files then receive the correctJavaProjectmarker when provenance is applied.Test plan
Existing tests pass
Manual testing with WAR project containing web.xml
Fixes moderneinc/customer-requests#1760