diff --git a/.asf.yaml b/.asf.yaml
new file mode 100644
index 000000000000..a6530be6806e
--- /dev/null
+++ b/.asf.yaml
@@ -0,0 +1,25 @@
+# see https://s.apache.org/asfyaml
+github:
+ description: "Apache Maven core"
+ homepage: https://maven.apache.org/ref/current
+ labels:
+ - java
+ - build-management
+ - apache-maven
+ - maven
+ - hacktoberfest
+ enabled_merge_buttons:
+ squash: true
+ merge: false
+ rebase: true
+ autolink_jira:
+ - MNG
+ pull_requests:
+ del_branch_on_merge: true
+ features:
+ issues: true
+notifications:
+ commits: commits@maven.apache.org
+ issues: issues@maven.apache.org
+ pullrequests: issues@maven.apache.org
+ jira_options: link label
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
new file mode 100644
index 000000000000..93ac858e2e00
--- /dev/null
+++ b/.git-blame-ignore-revs
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Change maven code style
+de19cfcd2bc8e774818d87472e8e64dc37c0b93d
diff --git a/.gitattributes b/.gitattributes
index 3bb3b5ea8a4d..150d31a7f0f4 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -6,3 +6,5 @@
*.css text
*.js text
*.sql text
+*.jar binary
+*.war binary
diff --git a/.github/ISSUE_TEMPLATE/BUG.yml b/.github/ISSUE_TEMPLATE/BUG.yml
new file mode 100644
index 000000000000..699181ff118f
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/BUG.yml
@@ -0,0 +1,48 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
+
+name: Bug Report
+description: File a bug report
+labels: ["bug"]
+
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thanks for taking the time to fill out this bug report.
+
+ Simple fixes in single PRs do not require issues.
+
+ **Do you use the latest project version?**
+
+ - type: input
+ id: version
+ attributes:
+ label: Affected version
+ validations:
+ required: true
+
+ - type: textarea
+ id: message
+ attributes:
+ label: Bug description
+ validations:
+ required: true
+
+
diff --git a/.github/ISSUE_TEMPLATE/FEATURE.yml b/.github/ISSUE_TEMPLATE/FEATURE.yml
new file mode 100644
index 000000000000..ddfd1a45e4db
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/FEATURE.yml
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
+
+name: Feature request
+description: File a proposal for new feature, improvement
+labels: ["enhancement"]
+
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thanks for taking the time to fill out this new feature, improvement proposal.
+
+ - type: textarea
+ id: message
+ attributes:
+ label: New feature, improvement proposal
+ validations:
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 000000000000..b27d66331198
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
+
+blank_issues_enabled: false
+
+contact_links:
+
+ - name: Project Mailing Lists
+ url: https://maven.apache.org/mailing-lists.html
+ about: Please ask a question or discuss here
diff --git a/.github/ci-extensions.xml b/.github/ci-extensions.xml
new file mode 100644
index 000000000000..5c6a0b437805
--- /dev/null
+++ b/.github/ci-extensions.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ eu.maveniverse.maven.mimir
+ extension
+ 0.7.8
+
+
\ No newline at end of file
diff --git a/.github/ci-mimir-daemon.properties b/.github/ci-mimir-daemon.properties
new file mode 100644
index 000000000000..86a84b6ac58d
--- /dev/null
+++ b/.github/ci-mimir-daemon.properties
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Mimir Daemon properties
+
+# Disable JGroups; we don't want/use LAN cache sharing
+mimir.jgroups.enabled=false
\ No newline at end of file
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 000000000000..1576b20f1381
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,66 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+version: 2
+updates:
+
+ - package-ecosystem: "maven"
+ directory: "/"
+ schedule:
+ interval: "daily"
+
+ - package-ecosystem: "maven"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ target-branch: "maven-4.0.x"
+ labels:
+ - "mvn40"
+ - "dependencies"
+
+ - package-ecosystem: "maven"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ target-branch: "maven-3.9.x"
+ labels:
+ - "mvn3"
+ - "dependencies"
+
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
+
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ target-branch: "maven-4.0.x"
+ labels:
+ - "mvn40"
+ - "dependencies"
+ - "github_actions"
+
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ target-branch: "maven-3.9.x"
+ labels:
+ - "mvn3"
+ - "dependencies"
+ - "github_actions"
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 2208cd74948c..6e422e4a09c7 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -1,30 +1,25 @@
-Following this checklist to help us incorporate your
+Following this checklist to help us incorporate your
contribution quickly and easily:
- - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MNG) filed
- for the change (usually before you start working on it). Trivial changes like typos do not
- require a JIRA issue. Your pull request should address just this issue, without
- pulling in other changes.
- - [ ] Each commit in the pull request should have a meaningful subject line and body.
- - [ ] Format the pull request title like `[MNG-XXX] - Fixes bug in ApproximateQuantiles`,
- where you replace `MNG-XXX` with the appropriate JIRA issue. Best practice
- is to use the JIRA issue title in the pull request title and in the first line of the
- commit message.
- - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will
- be performed on your pull request automatically.
- - [ ] You have run the [Core IT][core-its] successfully.
+- [ ] Your pull request should address just one issue, without pulling in other changes.
+- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
+- [ ] Each commit in the pull request should have a meaningful subject line and body.
+ Note that commits might be squashed by a maintainer on merge.
+- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
+ This may not always be possible but is a best-practice.
+- [ ] Run `mvn verify` to make sure basic checks pass.
+ A more thorough check will be performed on your pull request automatically.
+- [ ] You have run the [Core IT][core-its] successfully.
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
-To make clear that you license your contribution under
+To make clear that you license your contribution under
the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
-
- - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
+- [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
+- [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
[core-its]: https://maven.apache.org/core-its/core-it-suite/
diff --git a/.github/release-drafter-3.x.yml b/.github/release-drafter-3.x.yml
new file mode 100644
index 000000000000..da2e7a556cb7
--- /dev/null
+++ b/.github/release-drafter-3.x.yml
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+_extends: maven-gh-actions-shared:.github/release-drafter.yml
+tag-template: maven-$RESOLVED_VERSION
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
new file mode 100644
index 000000000000..add27b1def8a
--- /dev/null
+++ b/.github/release-drafter.yml
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+_extends: maven-gh-actions-shared
+tag-template: maven-$RESOLVED_VERSION
+
+include-pre-releases: true
+prerelease: true
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
new file mode 100644
index 000000000000..e6d585e3688a
--- /dev/null
+++ b/.github/workflows/maven.yml
@@ -0,0 +1,249 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Java CI
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+# allow single build per branch or PR
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+# clear all permissions for GITHUB_TOKEN
+permissions: {}
+
+jobs:
+ initial-build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up JDK
+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5
+ with:
+ java-version: 17
+ distribution: 'temurin'
+
+ - name: Checkout maven
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
+ with:
+ persist-credentials: false
+
+ - name: Prepare Mimir
+ shell: bash
+ run: |
+ mkdir -p ~/.mimir
+ cp .github/ci-extensions.xml ~/.m2/extensions.xml
+ cp .github/ci-mimir-daemon.properties ~/.mimir/daemon.properties
+
+ - name: Handle Mimir caches
+ uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
+ with:
+ path: ~/.mimir/local
+ key: mimir-${{ runner.os }}-initial-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ mimir-${{ runner.os }}-initial-
+ mimir-${{ runner.os }}-
+
+ - name: Set up Maven
+ shell: bash
+ run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper "-Dmaven=4.0.0-rc-3"
+
+ - name: Build Maven distributions
+ shell: bash
+ run: ./mvnw verify -e -B -V
+
+ - name: List contents of target directory
+ shell: bash
+ run: ls -la apache-maven/target
+
+ - name: Upload Maven distributions
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: maven-distributions
+ path: |
+ apache-maven/target/apache-maven*.zip
+ apache-maven/target/apache-maven*.tar.gz
+
+ full-build:
+ needs: initial-build
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ java: ['17', '21', '24']
+ steps:
+ - name: Set up JDK ${{ matrix.java }}
+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5
+ with:
+ java-version: ${{ matrix.java }}
+ distribution: 'temurin'
+
+ - name: Install Graphviz (MacOS)
+ if: runner.os == 'macOS'
+ run: brew install graphviz
+
+ - name: Install Graphviz (Ubuntu)
+ if: runner.os == 'Linux'
+ run: sudo apt-get install graphviz
+
+ - name: Install Graphviz (Windows)
+ if: runner.os == 'Windows'
+ run: choco install graphviz
+
+ - name: Checkout maven
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
+ with:
+ persist-credentials: false
+
+ - name: Prepare Mimir
+ shell: bash
+ run: |
+ mkdir -p ~/.m2
+ mkdir -p ~/.mimir
+ cp .github/ci-extensions.xml ~/.m2/extensions.xml
+ cp .github/ci-mimir-daemon.properties ~/.mimir/daemon.properties
+
+ - name: Handle Mimir caches
+ uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
+ with:
+ path: ~/.mimir/local
+ key: mimir-${{ runner.os }}-full-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ mimir-${{ runner.os }}-full-
+ mimir-${{ runner.os }}-
+
+ - name: Download Maven distribution
+ uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v4
+ with:
+ name: maven-distributions
+ path: maven-dist
+
+ - name: List downloaded files
+ shell: bash
+ run: ls -la maven-dist
+
+ - name: Extract Maven distribution
+ shell: bash
+ run: |
+ mkdir -p maven-local
+ if [ "${{ runner.os }}" = "Windows" ]; then
+ unzip maven-dist/apache-maven-*-bin.zip -d maven-local
+ # Get the name of the extracted directory
+ MAVEN_DIR=$(ls maven-local)
+ # Move contents up one level
+ mv "maven-local/$MAVEN_DIR"/* maven-local/
+ rm -r "maven-local/$MAVEN_DIR"
+ else
+ tar xzf maven-dist/apache-maven-*-bin.tar.gz -C maven-local --strip-components 1
+ fi
+ echo "MAVEN_HOME=$PWD/maven-local" >> $GITHUB_ENV
+ echo "$PWD/maven-local/bin" >> $GITHUB_PATH
+
+ - name: Build with downloaded Maven
+ shell: bash
+ run: mvn verify -Papache-release -Dgpg.skip=true -e -B -V
+
+ - name: Build site with downloaded Maven
+ shell: bash
+ run: mvn site -e -B -V -Preporting
+
+ - name: Upload test artifacts
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ if: failure() || cancelled()
+ with:
+ name: ${{ github.run_number }}-full-build-artifact-${{ runner.os }}-${{ matrix.java }}
+ path: '**/target/surefire-reports/*'
+
+ integration-tests:
+ needs: initial-build
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ java: ['17', '21', '24']
+ steps:
+ - name: Set up JDK ${{ matrix.java }}
+ uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5
+ with:
+ java-version: ${{ matrix.java }}
+ distribution: 'temurin'
+
+ - name: Checkout maven
+ uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4
+ with:
+ persist-credentials: false
+
+ - name: Prepare Mimir
+ shell: bash
+ run: |
+ mkdir -p ~/.m2
+ mkdir -p ~/.mimir
+ cp .github/ci-extensions.xml ~/.m2/extensions.xml
+ cp .github/ci-mimir-daemon.properties ~/.mimir/daemon.properties
+
+ - name: Handle Mimir caches
+ uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
+ with:
+ path: ~/.mimir/local
+ key: mimir-${{ runner.os }}-its-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ mimir-${{ runner.os }}-its-
+ mimir-${{ runner.os }}-
+
+ - name: Download Maven distribution
+ uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v4
+ with:
+ name: maven-distributions
+ path: maven-dist
+
+ - name: List downloaded files
+ shell: bash
+ run: ls -la maven-dist
+
+ - name: Extract Maven distribution
+ shell: bash
+ run: |
+ mkdir -p maven-local
+ if [ "${{ runner.os }}" = "Windows" ]; then
+ unzip maven-dist/apache-maven-*-bin.zip -d maven-local
+ # Get the name of the extracted directory
+ MAVEN_DIR=$(ls maven-local)
+ # Move contents up one level
+ mv "maven-local/$MAVEN_DIR"/* maven-local/
+ rm -r "maven-local/$MAVEN_DIR"
+ else
+ tar xzf maven-dist/apache-maven-*-bin.tar.gz -C maven-local --strip-components 1
+ fi
+ echo "MAVEN_HOME=$PWD/maven-local" >> $GITHUB_ENV
+ echo "$PWD/maven-local/bin" >> $GITHUB_PATH
+
+ - name: Build Maven and ITs and run them
+ shell: bash
+ run: mvn verify -e -B -V -Prun-its,mimir
+
+ - name: Upload test artifacts
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ if: failure() || cancelled()
+ with:
+ name: ${{ github.run_number }}-integration-test-artifact-${{ runner.os }}-${{ matrix.java }}
+ path: ./its/core-it-suite/target/test-classes/
diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml
new file mode 100644
index 000000000000..530759572d8f
--- /dev/null
+++ b/.github/workflows/pr-automation.yml
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: PR Automation
+on:
+ pull_request_target:
+ types:
+ - closed
+
+jobs:
+ pr-automation:
+ name: PR Automation
+ uses: apache/maven-gh-actions-shared/.github/workflows/pr-automation.yml@v4
diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
new file mode 100644
index 000000000000..96eaa60a0f66
--- /dev/null
+++ b/.github/workflows/release-drafter.yml
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Release Drafter
+on:
+ push:
+ branches:
+ - master
+ workflow_dispatch:
+
+jobs:
+ update_release_draft:
+ uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v4
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 000000000000..a3d320595715
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,28 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Stale
+
+on:
+ schedule:
+ - cron: '29 3 * * *'
+ issue_comment:
+ types: [ 'created' ]
+
+jobs:
+ stale:
+ uses: 'apache/maven-gh-actions-shared/.github/workflows/stale.yml@v4'
diff --git a/.gitignore b/.gitignore
index f79c9285cd4c..4e85f56fb4ce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,24 @@
-target/
+**/target/**
.project
.classpath
.settings/
.svn/
-bin/
+
# Intellij
*.ipr
*.iml
.idea
-out/
-.DS_Store
+!.idea/icon.png
/bootstrap
/dependencies.xml
.java-version
+.checkstyle
+.factorypath
+repo/
+
+# VSCode
+.vscode/
+
+# Mac
+.DS_Store
+
diff --git a/.idea/icon.png b/.idea/icon.png
new file mode 100644
index 000000000000..55035f1855aa
Binary files /dev/null and b/.idea/icon.png differ
diff --git a/.mvn/maven.config b/.mvn/maven.config
new file mode 100644
index 000000000000..c6f922ecc298
--- /dev/null
+++ b/.mvn/maven.config
@@ -0,0 +1 @@
+-DsessionRootDirectory=${session.rootDirectory}
\ No newline at end of file
diff --git a/.mvn/readme.txt b/.mvn/readme.txt
new file mode 100644
index 000000000000..c2d3655427cd
--- /dev/null
+++ b/.mvn/readme.txt
@@ -0,0 +1 @@
+The .mvn directory is needed to be able to use the ${maven.multiModuleProjectDirectory} property.
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9989fb163b29..a5b24766659e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-Contributing to Apache Maven
+Contributing to Apache Maven
======================
You have found a bug or you have an idea for a cool new feature? Contributing
@@ -29,11 +29,10 @@ which might be interesting to read and for further discussion.
Getting Started
---------------
-+ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
+ Make sure you have a [GitHub account](https://github.com/signup/free).
-+ If you're planning to implement a new feature, it makes sense to discuss your changes
++ If you're planning to implement a new feature, it makes sense to discuss your changes
on the [dev list](https://maven.apache.org/mailing-lists.html) first.
- This way you can make sure you're not wasting your time on something that isn't
+ This way you can make sure you're not wasting your time on something that isn't
considered to be in Apache Maven's scope.
+ Submit a ticket for your issue, assuming one does not already exist.
+ Clearly describe the issue, including steps to reproduce when it is a bug.
@@ -52,28 +51,15 @@ There are some guidelines which will make applying PRs easier for us:
+ Respect the original code style: by using the same [codestyle][code-style],
patches should only highlight the actual difference, not being disturbed by any formatting issues:
+ Only use spaces for indentation.
- + Create minimal diffs - disable on save actions like reformat source code or organize imports.
+ + Create minimal diffs - disable on save actions like reformat source code or organize imports.
If you feel the source code should be reformatted, create a separate PR for this change.
+ Check for unnecessary whitespace with `git diff --check` before committing.
-+ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue.
-```
-[MNG-XXX] - Subject of the JIRA Ticket
- Optional supplemental description.
-```
+ Make sure you have added the necessary tests (JUnit/[Core IT tests][core-it]) for your changes.
+ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken.
+ Submit a pull request to the repository in the Apache organization.
-+ Update your JIRA ticket and include a link to the pull request in the ticket.
If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla].
-Making Trivial Changes
-----------------------
-
-For changes of a trivial nature to comments and documentation, it is not always
-necessary to create a new ticket in JIRA. In this case, it is appropriate to
-start the first line of a commit with '(doc)' instead of a ticket number.
-
Additional Resources
--------------------
@@ -81,9 +67,10 @@ Additional Resources
+ [Apache Maven JIRA project page](https://issues.apache.org/jira/projects/MNG/)
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
-+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
-+ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject)
-+ #Maven IRC channel on freenode.org
++ [GitHub pull request documentation](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)
++ [Apache Maven X Account](https://x.com/ASFMavenProject)
++ [Apache Maven Bluesky Account](https://bsky.app/profile/maven.apache.org)
++ [Apache Maven Mastodon Account](https://mastodon.social/deck/@ASFMavenProject@fosstodon.org)
[dev-ml-list]: https://maven.apache.org/mailing-lists.html
[code-style]: https://maven.apache.org/developers/conventions/code.html
diff --git a/Jenkinsfile b/Jenkinsfile
index 5d5d998c0398..a1bc86896e5d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,173 +1,62 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: env.BRANCH_NAME=='master'?'5':'1'))])
-
-def buildOs = 'linux'
-def buildJdk = '8'
-def buildMvn = '3.6.0'
-def runITsOses = ['linux', 'windows']
-def runITsJdks = ['7', '8', '11','12']
-def runITsMvn = '3.6.0'
-def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V" // -DmavenDistro=... -Dmaven.test.failure.ignore=true
-def tests
-
-try {
-
-def osNode = jenkinsEnv.labelForOS(buildOs)
-node(jenkinsEnv.nodeSelection(osNode)) {
- dir('build') {
- stage('Checkout') {
- checkout scm
- }
-
- def WORK_DIR=pwd()
- def MAVEN_GOAL='verify'
-
- stage('Configure deploy') {
- if (env.BRANCH_NAME == 'master'){
- MAVEN_GOAL='deploy'
- }
- }
-
- stage('Build / Unit Test') {
- String jdkName = jenkinsEnv.jdkFromVersion(buildOs, buildJdk)
- String mvnName = jenkinsEnv.mvnFromVersion(buildOs, buildMvn)
- withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/.repository", options:[
- artifactsPublisher(disabled: false),
- junitPublisher(ignoreAttachments: false),
- findbugsPublisher(disabled: false),
- openTasksPublisher(disabled: false),
- dependenciesFingerprintPublisher(),
- invokerPublisher(),
- pipelineGraphPublisher()
- ]) {
- sh "mvn clean ${MAVEN_GOAL} -B -U -e -fae -V -Dmaven.test.failure.ignore=true"
- }
- dir ('apache-maven/target') {
- sh "mv apache-maven-*-bin.zip apache-maven-dist.zip"
- stash includes: 'apache-maven-dist.zip', name: 'dist'
+#!groovy
+
+pipeline {
+ agent none
+ // save some io during the build
+ options {
+ skipDefaultCheckout()
+ durabilityHint('PERFORMANCE_OPTIMIZED')
+ disableRestartFromStage()
+ }
+ stages {
+ stage("Build / Test - JDK17") {
+ agent { node { label 'ubuntu' } }
+ steps {
+ timeout(time: 210, unit: 'MINUTES') {
+ checkout scm
+ mavenBuild("jdk_17_latest", "")
+ script {
+ properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: isDeployedBranch() ? '30' : '5'))])
+ if (isDeployedBranch()) {
+ withEnv(["JAVA_HOME=${tool "jdk_17_latest"}",
+ "PATH+MAVEN=${ tool "jdk_17_latest" }/bin:${tool "maven_3_latest"}/bin",
+ "MAVEN_OPTS=-Xms4G -Xmx4G -Djava.awt.headless=true"]) {
+ sh "mvn clean deploy -DdeployAtEnd=true -B"
+ }
}
+ }
}
-
- tests = resolveScm source: [$class: 'GitSCMSource', credentialsId: '', id: '_', remote: 'https://gitbox.apache.org/repos/asf/maven-integration-testing.git', traits: [[$class: 'jenkins.plugins.git.traits.BranchDiscoveryTrait'], [$class: 'GitToolSCMSourceTrait', gitTool: 'Default']]], targets: [BRANCH_NAME, 'master']
+ }
}
+ }
}
-Map runITsTasks = [:]
-for (String os in runITsOses) {
- for (def jdk in runITsJdks) {
- String osLabel = jenkinsEnv.labelForOS(os);
- String jdkName = jenkinsEnv.jdkFromVersion(os, "${jdk}")
- String mvnName = jenkinsEnv.mvnFromVersion(os, "${runITsMvn}")
- echo "OS: ${os} JDK: ${jdk} => Label: ${osLabel} JDK: ${jdkName}"
-
- String stageId = "${os}-jdk${jdk}"
- String stageLabel = "Run ITs ${os.capitalize()} Java ${jdk}"
- runITsTasks[stageId] = {
- node(jenkinsEnv.nodeSelection(osLabel)) {
- stage("${stageLabel}") {
- echo "NODE_NAME = ${env.NODE_NAME}"
- // on Windows, need a short path or we hit 256 character limit for paths
- // using EXECUTOR_NUMBER guarantees that concurrent builds on same agent
- // will not trample each other plus workaround for JENKINS-52657
- dir(isUnix() ? 'test' : "c:\\mvn-it-${EXECUTOR_NUMBER}.tmp") {
- def WORK_DIR=pwd()
- checkout tests
- if (isUnix()) {
- sh "rm -rvf $WORK_DIR/apache-maven-dist.zip $WORK_DIR/it-local-repo"
- } else {
- bat "if exist it-local-repo rmdir /s /q it-local-repo"
- bat "if exist apache-maven-dist.zip del /q apache-maven-dist.zip"
- }
- unstash 'dist'
- try {
- withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
- junitPublisher(ignoreAttachments: false)
- ]) {
- String cmd = "${runITscommand} -DmavenDistro=$WORK_DIR/apache-maven-dist.zip -Dmaven.test.failure.ignore=true"
- if (stageId.endsWith('-jdk7')) {
- // Java 7u80 has TLS 1.2 disabled by default: need to explicitly enable
- cmd = "${cmd} -Dhttps.protocols=TLSv1.2"
- }
-
- if (isUnix()) {
- sh 'df -hT'
- sh "${cmd}"
- } else {
- bat 'wmic logicaldisk get size,freespace,caption'
- bat "${cmd}"
- }
- }
- } finally {
- archiveDirs(stageId, ['core-it-suite-logs':'core-it-suite/target/test-classes',
- 'core-it-suite-reports':'core-it-suite/target/surefire-reports'])
- deleteDir() // clean up after ourselves to reduce disk space
- }
- }
- }
- }
- }
- }
+boolean isDeployedBranch() {
+ return env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'maven-4.0.x' || env.BRANCH_NAME == 'maven-3.9.x'
}
-// run the parallel ITs
-parallel(runITsTasks)
-
-// JENKINS-34376 seems to make it hard to detect the aborted builds
-} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
- echo "[FAILURE-002] FlowInterruptedException ${e}"
- // this ambiguous condition means a user probably aborted
- if (e.causes.size() == 0) {
- currentBuild.result = "ABORTED"
- } else {
- currentBuild.result = "FAILURE"
- }
- throw e
-} catch (hudson.AbortException e) {
- echo "[FAILURE-003] AbortException ${e}"
- // this ambiguous condition means during a shell step, user probably aborted
- if (e.getMessage().contains('script returned exit code 143')) {
- currentBuild.result = "ABORTED"
- } else {
- currentBuild.result = "FAILURE"
+/**
+ * To other developers, if you are using this method above, please use the following syntax.
+ * By default this method does NOT execute ITs anymore, just "install".
+ *
+ * mavenBuild("", ""
+ *
+ * @param jdk the jdk tool name (in jenkins) to use for this build
+ * @param extraArgs extra command line args
+ */
+def mavenBuild(jdk, extraArgs) {
+ script {
+ try {
+ withEnv(["JAVA_HOME=${tool "$jdk"}",
+ "PATH+MAVEN=${tool "$jdk"}/bin:${tool "maven_3_latest"}/bin",
+ "MAVEN_OPTS=-Xms4G -Xmx4G -Djava.awt.headless=true"]) {
+ sh "mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper -Dmaven=3.9.10"
+ sh "echo run Its"
+ sh "./mvnw -e -B -V install $extraArgs"
+ }
}
- throw e
-} catch (InterruptedException e) {
- echo "[FAILURE-004] ${e}"
- currentBuild.result = "ABORTED"
- throw e
-} catch (Throwable e) {
- echo "[FAILURE-001] ${e}"
- currentBuild.result = "FAILURE"
- throw e
-} finally {
- // notify completion
- stage("Notifications") {
- jenkinsNotify()
- }
-}
-
-def archiveDirs(stageId, archives) {
- archives.each { archivePrefix, pathToContent ->
- if (fileExists(pathToContent)) {
- zip(zipFile: "${archivePrefix}-${stageId}.zip", dir: pathToContent, archive: true)
- }
+ finally {
+ junit testResults: '**/target/test-results-surefire/*.xml', allowEmptyResults: true
}
+ }
}
diff --git a/README.md b/README.md
index 0c77dabf55ae..65390379828a 100644
--- a/README.md
+++ b/README.md
@@ -18,16 +18,18 @@ Apache Maven
============
[][license]
-[](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.maven%22%20AND%20a%3A%22apache-maven%22)
-[][build]
-[][test-results]
+[](https://search.maven.org/artifact/org.apache.maven/apache-maven)
+[](https://search.maven.org/artifact/org.apache.maven/apache-maven)
+[](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/apache/maven/maven/README.md)
+[][build]
+[][test-results]
Apache Maven is a software project management and comprehension tool. Based on
the concept of a project object model (POM), Maven can manage a project's
build, reporting and documentation from a central piece of information.
-If you think you have found a bug, please file an issue in the [Maven Issue Tracker](https://issues.apache.org/jira/browse/MNG).
+If you think you have found a bug, please file an issue in the [Maven Issue Tracker](https://github.com/apache/maven/issues).
Documentation
-------------
@@ -39,48 +41,44 @@ the [Maven User List][users-list].
Where can I get the latest release?
-----------------------------------
-You can download release source from our [download page][maven-download].
+You can download the release source from our [download page][maven-download].
Contributing
------------
-If you are interested in the development of Maven, please consult the
-documentation first and afterwards you are welcome to join the developers
-mailing list to ask question or discuss new ideas / features / bugs etc.
+If you are interested in the development of Maven, please consult the
+documentation first and afterward you are welcome to join the developers
+mailing list to ask questions or discuss new ideas/features/bugs etc.
Take a look into the [contribution guidelines](CONTRIBUTING.md).
License
-------
-This code is under the [Apache Licence v2][license]
+This code is under the [Apache License, Version 2.0, January 2004][license].
-See the `NOTICE` file for required notices and attributions.
+See the [`NOTICE`](./NOTICE) file for required notices and attributions.
Donations
---------
-You like Apache Maven? Then [donate back to the ASF](https://www.apache.org/foundation/contributing.html) to support the development.
-
-License
--------
-[Apache License, Version 2.0, January 2004][license]
+Do you like Apache Maven? Then [donate back to the ASF](https://www.apache.org/foundation/contributing.html) to support the development.
Quick Build
-------
If you want to bootstrap Maven, you'll need:
-- Java 1.7+
-- Maven 3.0.5 or later
+- Java 17+
+- Maven 3.6.3 or later
- Run Maven, specifying a location into which the completed Maven distro should be installed:
-```
-mvn -DdistributionTargetDir="$HOME/app/maven/apache-maven-3.6.x-SNAPSHOT" clean package
-```
+ ```
+ mvn -DdistributionTargetDir="$HOME/app/maven/apache-maven-4.0.x-SNAPSHOT" clean package
+ ```
[home]: https://maven.apache.org/
[license]: https://www.apache.org/licenses/LICENSE-2.0
-[build]: https://builds.apache.org/job/maven-box/job/maven/job/master/
-[test-results]: https://builds.apache.org/job/maven-box/job/maven/job/master/lastCompletedBuild/testReport/
-[build-status]: https://img.shields.io/jenkins/s/https/builds.apache.org/job/maven-box/job/maven/job/master.svg?style=flat-square
-[build-tests]: https://img.shields.io/jenkins/t/https/builds.apache.org/job/maven-box/job/maven/job/master.svg?style=flat-square
+[build]: https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven/job/master/
+[test-results]: https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven/job/master/lastCompletedBuild/testReport/
+[build-status]: https://img.shields.io/jenkins/s/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven/job/master.svg?
+[build-tests]: https://img.shields.io/jenkins/t/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven/job/master.svg?
[maven-home]: https://maven.apache.org/
[maven-download]: https://maven.apache.org/download.cgi
[users-list]: https://maven.apache.org/mailing-lists.html
diff --git a/apache-maven/README.txt b/apache-maven/README.txt
index 3e93a8433a53..19468f8fa090 100644
--- a/apache-maven/README.txt
+++ b/apache-maven/README.txt
@@ -16,50 +16,12 @@
Release Notes
-------------
- The full list of changes can be found at https://maven.apache.org/docs/history.html.
-
- System Requirements
- -------------------
-
- JDK:
- 1.7 or above (this is to execute Maven - it still allows you to build against 1.3
- and prior JDK's).
- Memory:
- No minimum requirement.
- Disk:
- Approximately 10MB is required for the Maven installation itself. In addition to
- that, additional disk space will be used for your local Maven repository. The size
- of your local repository will vary depending on usage but expect at least 500MB.
- Operating System:
- Windows:
- Windows 2000 or above.
- Unix based systems (Linux, Solaris and Mac OS X) and others:
- No minimum requirement.
+ The full list of changes, system requirements and related can be found at https://maven.apache.org/docs/history.html.
Installing Maven
----------------
- 1) Unpack the archive where you would like to store the binaries, e.g.:
-
- Unix-based operating systems (Linux, Solaris and Mac OS X)
- tar zxvf apache-maven-3.x.y.tar.gz
- Windows
- unzip apache-maven-3.x.y.zip
-
- 2) A directory called "apache-maven-3.x.y" will be created.
-
- 3) Add the bin directory to your PATH, e.g.:
-
- Unix-based operating systems (Linux, Solaris and Mac OS X)
- export PATH=/usr/local/apache-maven-3.x.y/bin:$PATH
- Windows
- set PATH="c:\program files\apache-maven-3.x.y\bin";%PATH%
-
- 4) Make sure JAVA_HOME is set to the location of your JDK
-
- 5) Run "mvn --version" to verify that it is correctly installed.
-
- For complete documentation, see https://maven.apache.org/download.html#Installation
+ For complete documentation see https://maven.apache.org/download.html#Installation
Licensing
---------
@@ -69,7 +31,7 @@
Maven URLS
----------
- Home Page: https://maven.apache.org/
+ Home Page: https://maven.apache.org
Downloads: https://maven.apache.org/download.html
Release Notes: https://maven.apache.org/docs/history.html
Mailing Lists: https://maven.apache.org/mailing-lists.html
diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
index 7d85e7525202..6257d12978db 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -1,5 +1,4 @@
-
-
4.0.0org.apache.mavenmaven
- 3.6.3
+ 4.1.0-SNAPSHOTapache-maven
@@ -34,11 +32,11 @@ under the License.
Apache Maven DistributionThe Apache Maven distribution, source and binary, in zip and tar.gz formats.
-
- ${distributionId}-${project.version}
-
-
+
+ org.apache.maven
+ maven-cli
+ org.apache.mavenmaven-embedder
@@ -51,11 +49,7 @@ under the License.
org.apache.mavenmaven-compat
-
- org.eclipse.sisu
- org.eclipse.sisu.plexus
-
-
+
commons-clicommons-cli
@@ -63,30 +57,13 @@ under the License.
org.apache.maven.wagonwagon-http
- shaded
-
-
- org.apache.httpcomponents
- httpclient
-
-
- org.apache.httpcomponents
- httpcore
-
-
- org.apache.maven.wagon
- wagon-http-shared
-
-
-
- org.jsoup
- jsoup
- runtime
+ org.apache.maven.wagon
+ wagon-file
+
+
org.slf4jjcl-over-slf4j
@@ -94,56 +71,103 @@ under the License.
runtime
- org.apache.maven.wagon
- wagon-file
+ org.apache.maven.resolver
+ maven-resolver-connector-basicorg.apache.maven.resolver
- maven-resolver-connector-basic
+ maven-resolver-transport-file
+
org.apache.maven.resolvermaven-resolver-transport-wagon
+
+
+ org.apache.maven.resolver
+ maven-resolver-transport-apache
+
+
+
+ org.apache.maven.resolver
+ maven-resolver-transport-jdk
+ org.apache.maven
- maven-slf4j-provider
+ maven-logging
+
+
+ org.jline
+ jline-reader
- org.fusesource.jansi
- jansi
+ org.jline
+ jline-terminal-jni
+
+
+ org.jline
+ jline-terminal-ffm
+
+
+
+
+ javax.inject
+ javax.inject
+
+
+ javax.annotation
+ javax.annotation-api
+
+
+
+
+ org.eclipse.sisu
+ org.eclipse.sisu.plexus
+
+
+ org.eclipse.sisu
+ org.eclipse.sisu.inject
+
+
+ com.google.inject
+ guice
+ classes
+
+
+ org.ow2.asm
+ asm
+
+
+
+ false
+
+
+ true
+
+ apache.snapshots
+ https://repository.apache.org/snapshots/
+
+
+
- ${distributionFileName}
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- src/bin/m2.conf
-
-
-
-
- org.apache.maven.pluginsmaven-dependency-plugin
-
- jansi
- META-INF/native/**
-
- unpack-jansi-native
+ unpack-jline-nativeunpack-dependencies
+
+ jline-native
+ org/jline/nativ/**
+
@@ -163,12 +187,9 @@ under the License.
org.apache.maven.pluginsmaven-surefire-plugin
-
-
- basedir
- ${basedir}
-
-
+
+ ${basedir}
+
@@ -185,34 +206,60 @@ under the License.
create-distro-packages
- packagesingle
+ package
- src/main/assembly/bin.xml
+ src/assembly/bin.xml
+
+ eu.maveniverse.maven.plugins
+ bom-builder3
+ 1.2.1
+
+
+ skinny-bom
+
+ build-bom
+
+
+ skinny
+ Maven Dependencies Skinny BOM
+ Bill Of Materials for Apache Maven - Maven JARS only
+ maven-skinny-bom.xml
+ REACTOR
+ NONE
+ true
+ true
+
+
+
+ fat-bom
+
+ build-bom
+
+
+ fat
+ Maven Dependencies Fat BOM
+ Bill Of Materials for Apache Maven - All dependencies
+ maven-fat-bom.xml
+ REACTOR
+ CURRENT_PROJECT
+ true
+ true
+
+
+
+
-
-
- apache.snapshots
- http://repository.apache.org/snapshots/
-
- true
-
-
- false
-
-
-
-
create-distribution-in-dir
@@ -228,10 +275,10 @@ under the License.
maven-clean-plugin
+ clean-target-dirclean
- clean-target-dirprepare-packagetrue
@@ -249,17 +296,45 @@ under the License.
create-distribution-dir
- packagesingle
+ package./falsefalse${distributionTargetDir}
- src/main/assembly/dir.xml
+ src/assembly/dir.xml
+
+
+
+
+
+
+
+
+
+ run-its
+
+
+
+ maven-assembly-plugin
+
+
+ create-distribution-dir
+
+ single
+
+ package
+
+ ./
+ false
+ false
+ ${basedir}/target/maven
+
+ src/assembly/dir.xml
@@ -277,13 +352,13 @@ under the License.
make-src-assembly
- packagesingle
+ package
- src/main/assembly/src.xml
+ src/assembly/src.xmlgnu
@@ -294,31 +369,27 @@ under the License.
net.nicoulaj.maven.pluginschecksum-maven-plugin
+ 1.11source-release-checksum
- files
+ artifacts
+
+ bin,src
+
-
-
-
- ${project.build.directory}
-
- ${project.artifactId}-${project.version}-src.zip
- ${project.artifactId}-${project.version}-src.tar.gz
- ${project.artifactId}-${project.version}-bin.zip
- ${project.artifactId}-${project.version}-bin.tar.gz
-
-
-
- true
-
+
+ versionlessMavenDist
+
+ ${project.artifactId}
+
+
diff --git a/apache-maven/src/main/assembly/bin.xml b/apache-maven/src/assembly/bin.xml
similarity index 79%
rename from apache-maven/src/main/assembly/bin.xml
rename to apache-maven/src/assembly/bin.xml
index a04557d506d0..da2c686efe8e 100644
--- a/apache-maven/src/main/assembly/bin.xml
+++ b/apache-maven/src/assembly/bin.xml
@@ -17,14 +17,14 @@ specific language governing permissions and limitations
under the License.
-->
-
+binziptar.gz
- src/main/assembly/component.xml
+ src/assembly/component.xml
diff --git a/apache-maven/src/main/assembly/component.xml b/apache-maven/src/assembly/component.xml
similarity index 80%
rename from apache-maven/src/main/assembly/component.xml
rename to apache-maven/src/assembly/component.xml
index fab2c55c5d5c..4d75c9a38ca8 100644
--- a/apache-maven/src/main/assembly/component.xml
+++ b/apache-maven/src/assembly/component.xml
@@ -16,8 +16,8 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-
+false
@@ -63,15 +63,7 @@ under the License.
- target/dependency/META-INF/native
- lib/jansi-native
-
- **
-
- 0755
-
-
- src/bin
+ src/assembly/maven/binbin*.cmd
@@ -80,11 +72,24 @@ under the License.
dos
- src/bin
+ target/dependency/org/jline/nativ
+ lib/jline-native
+
+ **/*.so
+ **/*.jnilib
+ **/*.dll
+
+
+
+ src/assembly/maven/binbinmvn
+ mvnenc
+ mvnsh
+ mvnupmvnDebug
+ mvnencDebugmvnyjp
@@ -92,11 +97,11 @@ under the License.
0755
- src/conf
+ src/assembly/maven/confconf
- src/lib
+ src/assembly/maven/liblib
diff --git a/apache-maven/src/main/assembly/dir.xml b/apache-maven/src/assembly/dir.xml
similarity index 79%
rename from apache-maven/src/main/assembly/dir.xml
rename to apache-maven/src/assembly/dir.xml
index 580b2098d632..514cb9e89b7c 100644
--- a/apache-maven/src/main/assembly/dir.xml
+++ b/apache-maven/src/assembly/dir.xml
@@ -17,14 +17,14 @@ specific language governing permissions and limitations
under the License.
-->
-
+dirdirfalse
- src/main/assembly/component.xml
+ src/assembly/component.xml
diff --git a/apache-maven/src/bin/.gitattributes b/apache-maven/src/assembly/maven/bin/.gitattributes
similarity index 100%
rename from apache-maven/src/bin/.gitattributes
rename to apache-maven/src/assembly/maven/bin/.gitattributes
diff --git a/apache-maven/src/assembly/maven/bin/m2.conf b/apache-maven/src/assembly/maven/bin/m2.conf
new file mode 100644
index 000000000000..b91431dea5f9
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/m2.conf
@@ -0,0 +1,33 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set maven.mainClass default org.apache.maven.cling.MavenCling
+
+main is ${maven.mainClass} from plexus.core
+
+set maven.conf default ${maven.home}/conf
+set maven.installation.conf default ${maven.conf}
+
+[plexus.core]
+load ${maven.conf}/logging
+optionally ${maven.home}/lib/ext/redisson/*.jar
+optionally ${maven.home}/lib/ext/hazelcast/*.jar
+optionally ${user.home}/.m2/ext/*.jar
+optionally ${maven.home}/lib/ext/*.jar
+load ${maven.home}/lib/maven-*.jar
+load ${maven.home}/lib/*.jar
diff --git a/apache-maven/src/assembly/maven/bin/mvn b/apache-maven/src/assembly/maven/bin/mvn
new file mode 100755
index 000000000000..8559d47af557
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/mvn
@@ -0,0 +1,263 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# -----------------------------------------------------------------------------
+# Apache Maven Startup Script
+#
+# Environment Variable Prerequisites
+#
+# JAVA_HOME (Optional) Points to a Java installation.
+# MAVEN_ARGS (Optional) Arguments passed to Maven before CLI arguments.
+# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+# MAVEN_DEBUG_OPTS (Optional) Specify the debug options to use. Default value is "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${MAVEN_DEBUG_ADDRESS}" when --debug is used
+# MAVEN_DEBUG_ADDRESS (Optional) Set the debug address. Default value is "localhost:8000"
+# -----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /usr/local/etc/mavenrc ] ; then
+ . /usr/local/etc/mavenrc
+ fi
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+mingw=false;
+case "`uname`" in
+ CYGWIN*) cygwin=true;;
+ MINGW*) mingw=true;;
+esac
+
+## resolve links - $0 may be a link to Maven's home
+PRG="$0"
+
+# need this for relative symlinks
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+done
+
+saveddir=`pwd`
+
+MAVEN_HOME=`dirname "$PRG"`/..
+
+# make it fully qualified
+MAVEN_HOME=`cd "$MAVEN_HOME" && pwd`
+
+cd "$saveddir"
+
+CLASSWORLDS_CONF="$MAVEN_HOME/bin/m2.conf"
+
+# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
+if $cygwin || $mingw ; then
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+
+ if [ ! -x "$JAVACMD" ] ; then
+ echo "The JAVA_HOME environment variable is not defined correctly, so Apache Maven cannot be started." >&2
+ echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" does not exist." >&2
+ exit 1
+ fi
+ fi
+else
+ JAVACMD="`\\unset -f command; \\command -v java`"
+
+ if [ ! -x "$JAVACMD" ] ; then
+ echo "The java(1) command does not exist in PATH nor is JAVA_HOME set, so Apache Maven cannot be started." >&2
+ exit 1
+ fi
+fi
+
+if ! "$JAVACMD" --enable-native-access=ALL-UNNAMED -version >/dev/null 2>&1; then
+ echo "Error: Apache Maven 4.x requires Java 17 or newer to run." >&2
+ "$JAVACMD" -version >&2
+ echo "Please upgrade your Java installation or set JAVA_HOME to point to a compatible JDK." >&2
+ exit 1
+fi
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+(
+ basedir=`find_file_argument_basedir "$@"`
+ wdir="$basedir"
+ while :
+ do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ if [ "$wdir" = '/' ] ; then
+ break
+ fi
+ wdir=`cd "$wdir/.."; pwd`
+ done
+ echo "$basedir"
+)
+}
+
+find_file_argument_basedir() {
+(
+ basedir=`pwd`
+
+ found_file_switch=0
+ for arg in "$@"; do
+ if [ ${found_file_switch} -eq 1 ]; then
+ if [ -d "${arg}" ]; then
+ basedir=`cd "${arg}" && pwd -P`
+ elif [ -f "${arg}" ]; then
+ basedir=`dirname "${arg}"`
+ basedir=`cd "$basedir" && pwd -P`
+ if [ ! -d "$basedir" ]; then
+ echo "Directory $basedir extracted from the -f/--file command-line argument ${arg} does not exist" >&2
+ exit 1
+ fi
+ else
+ echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
+ exit 1
+ fi
+ break
+ fi
+ if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
+ found_file_switch=1
+ fi
+ done
+ echo "$basedir"
+)
+}
+
+# concatenates all lines of a file and replaces variables
+concat_lines() {
+ if [ -f "$1" ]; then
+ # First convert all CR to LF using tr
+ tr '\r' '\n' < "$1" | \
+ sed -e '/^$/d' -e 's/#.*$//' | \
+ # Replace LF with NUL for xargs
+ tr '\n' '\0' | \
+ # Split into words and process each argument
+ # Use -0 with NUL to avoid special behaviour on quotes
+ xargs -n 1 -0 | \
+ while read -r arg; do
+ # Replace variables first
+ arg=$(echo "$arg" | sed \
+ -e "s@\${MAVEN_PROJECTBASEDIR}@$MAVEN_PROJECTBASEDIR@g" \
+ -e "s@\$MAVEN_PROJECTBASEDIR@$MAVEN_PROJECTBASEDIR@g")
+
+ echo "$arg"
+ done | \
+ tr '\n' ' '
+ fi
+}
+
+MAVEN_PROJECTBASEDIR="`find_maven_basedir "$@"`"
+MAVEN_OPTS="$MAVEN_OPTS `concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"`"
+LAUNCHER_JAR=`echo "$MAVEN_HOME"/boot/plexus-classworlds-*.jar`
+LAUNCHER_CLASS=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# For Cygwin and MinGW, switch paths to Windows format before running java(1) command
+if $cygwin || $mingw ; then
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
+ LAUNCHER_JAR=`cygpath --windows "$LAUNCHER_JAR"`
+ CLASSWORLDS_CONF=`cygpath --windows "$CLASSWORLDS_CONF"`
+ MAVEN_HOME=`cygpath --windows "$MAVEN_HOME"`
+ MAVEN_PROJECTBASEDIR=`cygpath --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+handle_args() {
+ while [ $# -gt 0 ]; do
+ case $1 in
+ --debug)
+ if [ -z "$MAVEN_DEBUG_OPTS" ] ; then
+ MAVEN_DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${MAVEN_DEBUG_ADDRESS:-localhost:8000}"
+ else
+ echo "Ignoring --debug option as MAVEN_DEBUG_OPTS is already set"
+ fi
+ ;;
+ --yjp)
+ if [ ! -f "$YJPLIB" ]; then
+ echo "Error: Unable to autodetect the YJP library location. Please set YJPLIB variable" >&2
+ exit 1
+ fi
+ MAVEN_OPTS="-agentpath:$YJPLIB=onexit=snapshot,onexit=memory,tracing,onlylocal $MAVEN_OPTS"
+ ;;
+ --enc)
+ MAVEN_MAIN_CLASS="org.apache.maven.cling.MavenEncCling"
+ ;;
+ --shell)
+ MAVEN_MAIN_CLASS="org.apache.maven.cling.MavenShellCling"
+ ;;
+ --up)
+ MAVEN_MAIN_CLASS="org.apache.maven.cling.MavenUpCling"
+ ;;
+ *)
+ ;;
+ esac
+ shift
+ done
+}
+
+handle_args "$@"
+MAVEN_MAIN_CLASS=${MAVEN_MAIN_CLASS:=org.apache.maven.cling.MavenCling}
+
+cmd="\"$JAVACMD\" \
+ $MAVEN_OPTS \
+ $MAVEN_DEBUG_OPTS \
+ --enable-native-access=ALL-UNNAMED \
+ -classpath \"$LAUNCHER_JAR\" \
+ \"-Dclassworlds.conf=$CLASSWORLDS_CONF\" \
+ \"-Dmaven.home=$MAVEN_HOME\" \
+ \"-Dmaven.mainClass=$MAVEN_MAIN_CLASS\" \
+ \"-Dlibrary.jline.path=${MAVEN_HOME}/lib/jline-native\" \
+ \"-Dmaven.multiModuleProjectDirectory=$MAVEN_PROJECTBASEDIR\" \
+ $LAUNCHER_CLASS \
+ $MAVEN_ARGS"
+# Add remaining arguments with proper quoting
+for arg in "$@"; do
+ cmd="$cmd \"$arg\""
+done
+
+# Debug: print the command that will be executed
+#echo "About to execute:"
+#echo "$cmd"
+
+eval exec "$cmd"
diff --git a/apache-maven/src/assembly/maven/bin/mvn.cmd b/apache-maven/src/assembly/maven/bin/mvn.cmd
new file mode 100644
index 000000000000..a3e8600df3d1
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/mvn.cmd
@@ -0,0 +1,289 @@
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+@REM -----------------------------------------------------------------------------
+@REM Apache Maven Startup Script
+@REM
+@REM Environment Variable Prerequisites
+@REM
+@REM JAVA_HOME (Optional) Points to a Java installation.
+@REM MAVEN_ARGS (Optional) Arguments passed to Maven before CLI arguments.
+@REM MAVEN_BATCH_ECHO (Optional) Set to 'on' to enable the echoing of the batch commands.
+@REM MAVEN_BATCH_PAUSE (Optional) set to 'on' to wait for a key stroke before ending.
+@REM MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+@REM MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+@REM -----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO%
+
+@REM Clear/define a variable for any options to be inserted via script
+@REM We want to avoid trying to parse the external MAVEN_OPTS variable
+SET INTERNAL_MAVEN_OPTS=
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%"=="" goto skipRc
+if exist "%PROGRAMDATA%\mavenrc.cmd" call "%PROGRAMDATA%\mavenrc.cmd" %*
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" echo Warning: The mavenrc_pre.bat script is deprecated and will be removed in a future version. >&2
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" echo Warning: The mavenrc_pre.cmd script is deprecated and will be removed in a future version. >&2
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+if exist "%USERPROFILE%\mavenrc.cmd" call "%USERPROFILE%\mavenrc.cmd" %*
+:skipRc
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%"=="" goto javaHomeSet
+for %%i in (java.exe) do set "JAVACMD=%%~$PATH:i"
+goto checkJavaCmd
+
+:javaHomeSet
+set "JAVACMD=%JAVA_HOME%\bin\java.exe"
+
+if not exist "%JAVACMD%" (
+ echo The JAVA_HOME environment variable is not defined correctly, so Apache Maven cannot be started. >&2
+ echo JAVA_HOME is set to "%JAVA_HOME%", but "%%JAVA_HOME%%\bin\java.exe" does not exist. >&2
+ goto error
+)
+
+:checkJavaCmd
+if not exist "%JAVACMD%" (
+ echo The java.exe command does not exist in PATH nor is JAVA_HOME set, so Apache Maven cannot be started. >&2
+ goto error
+)
+
+@REM Check Java version by testing the Java 17+ flag
+"%JAVACMD%" --enable-native-access=ALL-UNNAMED -version >nul 2>&1
+if ERRORLEVEL 1 (
+ echo Error: Apache Maven 4.x requires Java 17 or newer to run. >&2
+ "%JAVACMD%" -version >&2
+ echo Please upgrade your Java installation or set JAVA_HOME to point to a compatible JDK. >&2
+ goto error
+)
+
+:chkMHome
+set "MAVEN_HOME=%~dp0"
+set "MAVEN_HOME=%MAVEN_HOME:~0,-5%"
+if "%MAVEN_HOME%"=="" goto error
+
+:checkMCmd
+if not exist "%MAVEN_HOME%\bin\mvn.cmd" goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+set "CLASSWORLDS_CONF=%MAVEN_HOME%\bin\m2.conf"
+
+@REM Find the project basedir, i.e., the directory that contains the directory ".mvn".
+@REM Fallback to current working directory if not found.
+
+set "EXEC_DIR=%CD%"
+set "WDIR=%EXEC_DIR%"
+
+@REM Look for the --file switch and start the search for the .mvn directory from the specified
+@REM POM location, if supplied.
+
+set FILE_ARG=
+:arg_loop
+if "%~1" == "-f" (
+ set "FILE_ARG=%~2"
+ shift
+ goto process_file_arg
+)
+if "%~1" == "--file" (
+ set "FILE_ARG=%~2"
+ shift
+ goto process_file_arg
+)
+@REM If none of the above, skip the argument
+shift
+if not "%~1" == "" (
+ goto arg_loop
+) else (
+ goto findBaseDir
+)
+
+:process_file_arg
+if "%FILE_ARG%" == "" (
+ goto findBaseDir
+)
+if not exist "%FILE_ARG%" (
+ echo POM file "%FILE_ARG%" specified the -f/--file command-line argument does not exist >&2
+ goto error
+)
+if exist "%FILE_ARG%\*" (
+ set "POM_DIR=%FILE_ARG%"
+) else (
+ call :get_directory_from_file "%FILE_ARG%"
+)
+if not exist "%POM_DIR%" (
+ echo Directory "%POM_DIR%" extracted from the -f/--file command-line argument "%FILE_ARG%" does not exist >&2
+ goto error
+)
+set "WDIR=%POM_DIR%"
+goto findBaseDir
+
+:get_directory_from_file
+set "POM_DIR=%~dp1"
+:stripPomDir
+if not "_%POM_DIR:~-1%"=="_\" goto pomDirStripped
+set "POM_DIR=%POM_DIR:~0,-1%"
+goto stripPomDir
+:pomDirStripped
+exit /b
+
+:findBaseDir
+cd /d "%WDIR%"
+set "WDIR=%CD%"
+:findBaseDirLoop
+if exist ".mvn" goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set "WDIR=%CD%"
+goto findBaseDirLoop
+
+:baseDirFound
+set "MAVEN_PROJECTBASEDIR=%WDIR%"
+cd /d "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+if "_%EXEC_DIR:~-1%"=="_\" set "EXEC_DIR=%EXEC_DIR:~0,-1%"
+set "MAVEN_PROJECTBASEDIR=%EXEC_DIR%"
+cd /d "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+if not exist "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadJvmConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+set JVM_CONFIG_MAVEN_OPTS=
+for /F "usebackq tokens=* delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do (
+ set "line=%%a"
+
+ rem Skip empty lines and full-line comments
+ echo !line! | findstr /b /r /c:"[ ]*#" >nul
+ if errorlevel 1 (
+ rem Handle end-of-line comments by taking everything before #
+ for /f "tokens=1* delims=#" %%i in ("!line!") do set "line=%%i"
+
+ rem Trim leading/trailing spaces while preserving spaces in quotes
+ set "trimmed=!line!"
+ for /f "tokens=* delims= " %%i in ("!trimmed!") do set "trimmed=%%i"
+ for /l %%i in (1,1,100) do if "!trimmed:~-1!"==" " set "trimmed=!trimmed:~0,-1!"
+
+ rem Replace MAVEN_PROJECTBASEDIR placeholders
+ set "trimmed=!trimmed:${MAVEN_PROJECTBASEDIR}=%MAVEN_PROJECTBASEDIR%!"
+ set "trimmed=!trimmed:$MAVEN_PROJECTBASEDIR=%MAVEN_PROJECTBASEDIR%!"
+
+ if not "!trimmed!"=="" (
+ if "!JVM_CONFIG_MAVEN_OPTS!"=="" (
+ set "JVM_CONFIG_MAVEN_OPTS=!trimmed!"
+ ) else (
+ set "JVM_CONFIG_MAVEN_OPTS=!JVM_CONFIG_MAVEN_OPTS! !trimmed!"
+ )
+ )
+ )
+)
+@endlocal & set JVM_CONFIG_MAVEN_OPTS=%JVM_CONFIG_MAVEN_OPTS%
+
+:endReadJvmConfig
+
+@REM do not let MAVEN_PROJECTBASEDIR end with a single backslash which would escape the double quote. This happens when .mvn at drive root.
+if "_%MAVEN_PROJECTBASEDIR:~-1%"=="_\" set "MAVEN_PROJECTBASEDIR=%MAVEN_PROJECTBASEDIR%\"
+
+if "%MAVEN_DEBUG_ADDRESS%"=="" set MAVEN_DEBUG_ADDRESS=localhost:8000
+
+goto endHandleArgs
+:handleArgs
+if "%~1"=="--debug" (
+ if "%MAVEN_DEBUG_OPTS%"=="" (
+ set "MAVEN_DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%MAVEN_DEBUG_ADDRESS%"
+ )
+) else if "%~1"=="--yjp" (
+ if not exist "%YJPLIB%" (
+ echo Error: Unable to autodetect the YJP library location. Please set YJPLIB variable >&2
+ exit /b 1
+ )
+ set "INTERNAL_MAVEN_OPTS=-agentpath:%YJPLIB%=onexit=snapshot,onexit=memory,tracing,onlylocal %INTERNAL_MAVEN_OPTS%"
+) else if "%~1"=="--enc" (
+ set "MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenEncCling"
+) else if "%~1"=="--shell" (
+ set "MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenShellCling"
+) else if "%~1"=="--up" (
+ set "MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenUpCling"
+)
+exit /b 0
+
+:processArgs
+if "%~1"=="" exit /b 0
+call :handleArgs %1
+shift
+goto processArgs
+
+:endHandleArgs
+call :processArgs %*
+
+for %%i in ("%MAVEN_HOME%"\boot\plexus-classworlds-*) do set LAUNCHER_JAR="%%i"
+set LAUNCHER_CLASS=org.codehaus.plexus.classworlds.launcher.Launcher
+if "%MAVEN_MAIN_CLASS%"=="" @set MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenCling
+
+"%JAVACMD%" ^
+ %INTERNAL_MAVEN_OPTS% ^
+ %MAVEN_OPTS% ^
+ %JVM_CONFIG_MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ --enable-native-access=ALL-UNNAMED ^
+ -classpath %LAUNCHER_JAR% ^
+ "-Dclassworlds.conf=%CLASSWORLDS_CONF%" ^
+ "-Dmaven.home=%MAVEN_HOME%" ^
+ "-Dmaven.mainClass=%MAVEN_MAIN_CLASS%" ^
+ "-Dlibrary.jline.path=%MAVEN_HOME%\lib\jline-native" ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %LAUNCHER_CLASS% ^
+ %MAVEN_ARGS% ^
+ %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" echo Warning: The mavenrc_post.bat script is deprecated and will be removed in a future version. >&2
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" echo Warning: The mavenrc_post.cmd script is deprecated and will be removed in a future version. >&2
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+exit /b %ERROR_CODE%
diff --git a/apache-maven/src/assembly/maven/bin/mvnDebug b/apache-maven/src/assembly/maven/bin/mvnDebug
new file mode 100644
index 000000000000..1b4bd5a97ea9
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/mvnDebug
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# -----------------------------------------------------------------------------
+# Apache Maven Debug Script
+#
+# Environment Variable Prerequisites
+#
+# JAVA_HOME (Optional) Points to a Java installation.
+# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+# MAVEN_DEBUG_ADDRESS (Optional) Set the debug address. Default value is localhost:8000
+# -----------------------------------------------------------------------------
+
+echo "This script is deprecated for removal, please use 'mvn --debug' instead"
+"`dirname "$0"`/mvn" --debug "$@"
diff --git a/apache-maven/src/assembly/maven/bin/mvnDebug.cmd b/apache-maven/src/assembly/maven/bin/mvnDebug.cmd
new file mode 100644
index 000000000000..52439c366a42
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/mvnDebug.cmd
@@ -0,0 +1,41 @@
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+@REM -----------------------------------------------------------------------------
+@REM Apache Maven Debug Script
+@REM
+@REM Environment Variable Prerequisites
+@REM
+@REM JAVA_HOME (Optional) Points to a Java installation.
+@REM MAVEN_BATCH_ECHO (Optional) Set to 'on' to enable the echoing of the batch commands.
+@REM MAVEN_BATCH_PAUSE (Optional) set to 'on' to wait for a key stroke before ending.
+@REM MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+@REM MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+@REM MAVEN_DEBUG_ADDRESS (Optional) Set the debug address. Default value is localhost:8000
+@REM -----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO%
+
+@setlocal
+
+echo "This script is deprecated for removal, please use 'mvn --debug' instead"
+@call "%~dp0"mvn.cmd --debug %*
diff --git a/apache-maven/src/assembly/maven/bin/mvnenc b/apache-maven/src/assembly/maven/bin/mvnenc
new file mode 100644
index 000000000000..c6067dda62b2
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/mvnenc
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# -----------------------------------------------------------------------------
+# Apache Maven Encrypt Script
+#
+# Environment Variable Prerequisites
+#
+# JAVA_HOME (Optional) Points to a Java installation.
+# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+# -----------------------------------------------------------------------------
+
+"`dirname "$0"`/mvn" --enc "$@"
diff --git a/apache-maven/src/assembly/maven/bin/mvnenc.cmd b/apache-maven/src/assembly/maven/bin/mvnenc.cmd
new file mode 100644
index 000000000000..f8b0fb9bdb65
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/mvnenc.cmd
@@ -0,0 +1,39 @@
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+@REM -----------------------------------------------------------------------------
+@REM Apache Maven Encrypt Script
+@REM
+@REM Environment Variable Prerequisites
+@REM
+@REM JAVA_HOME (Optional) Points to a Java installation.
+@REM MAVEN_BATCH_ECHO (Optional) Set to 'on' to enable the echoing of the batch commands.
+@REM MAVEN_BATCH_PAUSE (Optional) set to 'on' to wait for a key stroke before ending.
+@REM MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+@REM MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+@REM -----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO%
+
+@setlocal
+
+@call "%~dp0"mvn.cmd --enc %*
diff --git a/apache-maven/src/assembly/maven/bin/mvnsh b/apache-maven/src/assembly/maven/bin/mvnsh
new file mode 100644
index 000000000000..e3f847cdf5b0
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/mvnsh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# -----------------------------------------------------------------------------
+# Apache Maven Encrypt Script
+#
+# Environment Variable Prerequisites
+#
+# JAVA_HOME (Optional) Points to a Java installation.
+# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+# -----------------------------------------------------------------------------
+
+"`dirname "$0"`/mvn" --shell "$@"
diff --git a/apache-maven/src/assembly/maven/bin/mvnsh.cmd b/apache-maven/src/assembly/maven/bin/mvnsh.cmd
new file mode 100644
index 000000000000..1b8ac48f3de6
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/mvnsh.cmd
@@ -0,0 +1,39 @@
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+@REM -----------------------------------------------------------------------------
+@REM Apache Maven Encrypt Script
+@REM
+@REM Environment Variable Prerequisites
+@REM
+@REM JAVA_HOME (Optional) Points to a Java installation.
+@REM MAVEN_BATCH_ECHO (Optional) Set to 'on' to enable the echoing of the batch commands.
+@REM MAVEN_BATCH_PAUSE (Optional) set to 'on' to wait for a key stroke before ending.
+@REM MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+@REM MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+@REM -----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO%
+
+@setlocal
+
+@call "%~dp0"mvn.cmd --shell %*
diff --git a/apache-maven/src/assembly/maven/bin/mvnup b/apache-maven/src/assembly/maven/bin/mvnup
new file mode 100755
index 000000000000..83cce8714e63
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/mvnup
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# -----------------------------------------------------------------------------
+# Apache Maven Upgrade Script
+#
+# Environment Variable Prerequisites
+#
+# JAVA_HOME (Optional) Points to a Java installation.
+# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+# -----------------------------------------------------------------------------
+
+"`dirname "$0"`/mvn" --up "$@"
diff --git a/apache-maven/src/assembly/maven/bin/mvnup.cmd b/apache-maven/src/assembly/maven/bin/mvnup.cmd
new file mode 100644
index 000000000000..21fa1fadc93e
--- /dev/null
+++ b/apache-maven/src/assembly/maven/bin/mvnup.cmd
@@ -0,0 +1,37 @@
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+@REM -----------------------------------------------------------------------------
+@REM Apache Maven Upgrade Script
+@REM
+@REM Environment Variable Prerequisites
+@REM
+@REM JAVA_HOME (Optional) Points to a Java installation.
+@REM MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
+@REM MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
+@REM -----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO%
+
+@setlocal
+
+@call "%~dp0"mvn.cmd --up %*
diff --git a/apache-maven/src/bin/mvnyjp b/apache-maven/src/assembly/maven/bin/mvnyjp
old mode 100755
new mode 100644
similarity index 83%
rename from apache-maven/src/bin/mvnyjp
rename to apache-maven/src/assembly/maven/bin/mvnyjp
index a35eabf1f642..5e76db1c8c86
--- a/apache-maven/src/bin/mvnyjp
+++ b/apache-maven/src/assembly/maven/bin/mvnyjp
@@ -27,9 +27,5 @@
# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
# -----------------------------------------------------------------------------
-if [ ! -f "$YJPLIB" ]; then
- echo "Error: Unable to autodetect the YJP library location. Please set YJPLIB variable" >&2
- exit 1
-fi
-
-env MAVEN_OPTS="-agentpath:$YJPLIB=onexit=snapshot,onexit=memory,tracing,onlylocal $MAVEN_OPTS" "`dirname "$0"`/mvn" "$@"
+echo "This script is deprecated for removal, please use 'mvn --yjp' instead"
+"`dirname "$0"`/mvn" --yjp "$@"
diff --git a/apache-maven/src/assembly/maven/conf/logging/maven.logger.properties b/apache-maven/src/assembly/maven/conf/logging/maven.logger.properties
new file mode 100644
index 000000000000..18c71c687cfe
--- /dev/null
+++ b/apache-maven/src/assembly/maven/conf/logging/maven.logger.properties
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+maven.logger.defaultLogLevel=info
+maven.logger.showDateTime=false
+maven.logger.showThreadName=false
+maven.logger.showLogName=false
+maven.logger.logFile=System.out
+maven.logger.cacheOutputStream=true
+maven.logger.levelInBrackets=true
+maven.logger.log.Sisu=info
+maven.logger.warnLevelString=WARNING
+
+# MNG-6181: mvn -X also prints all debug logging from HttpClient
+maven.logger.log.org.apache.http=off
+maven.logger.log.org.apache.http.wire=off
diff --git a/apache-maven/src/assembly/maven/conf/maven-system.properties b/apache-maven/src/assembly/maven/conf/maven-system.properties
new file mode 100644
index 000000000000..49466972a817
--- /dev/null
+++ b/apache-maven/src/assembly/maven/conf/maven-system.properties
@@ -0,0 +1,67 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Maven system properties
+#
+# The properties defined in this file will be made available through
+# system properties at the very beginning of Maven's boot process.
+#
+
+maven.installation.conf = ${maven.home}/conf
+maven.user.conf = ${user.home}/.m2
+maven.project.conf = ${session.rootDirectory}/.mvn
+
+# Comma-separated list of files to include.
+# Each item may be enclosed in quotes to gracefully include spaces. Items are trimmed before being loaded.
+# If the first character of an item is a question mark, the load will silently fail if the file does not exist.
+${includes} = ?"${maven.user.conf}/maven-system.properties", \
+ ?"${maven.project.conf}/maven-system.properties"
+
+#
+# Settings
+#
+# Define the default three levels for settings.
+# The '-is' flag will override the 'maven.installation.settings' property.
+# The '-ps' flag will override the 'maven.project.settings' property.
+# The '-s' flag will override the 'maven.user.settings' property.
+maven.installation.settings = ${maven.installation.conf}/settings.xml
+maven.project.settings = ${maven.project.conf}/settings.xml
+maven.user.settings = ${maven.user.conf}/settings.xml
+
+#
+# Toolchains
+#
+# Define the default three levels for toolchains.
+# The '-it' flag will override the 'maven.installation.toolchains' property.
+# The '-t' flag will override the 'maven.user.toolchains' property.
+maven.installation.toolchains = ${maven.installation.conf}/toolchains.xml
+maven.user.toolchains = ${maven.user.conf}/toolchains.xml
+
+#
+# Extensions
+#
+maven.installation.extensions = ${maven.installation.conf}/extensions.xml
+maven.project.extensions = ${maven.project.conf}/extensions.xml
+maven.user.extensions = ${maven.user.conf}/extensions.xml
+
+#
+# Maven central repository URL.
+#
+maven.repo.central = ${env.MAVEN_REPO_CENTRAL:-https://repo.maven.apache.org/maven2}
diff --git a/apache-maven/src/assembly/maven/conf/maven-user.properties b/apache-maven/src/assembly/maven/conf/maven-user.properties
new file mode 100644
index 000000000000..a5813a5eac26
--- /dev/null
+++ b/apache-maven/src/assembly/maven/conf/maven-user.properties
@@ -0,0 +1,31 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# Maven user properties
+#
+# The properties defined in this file will be made available through
+# user properties at the very beginning of Maven's boot process.
+#
+
+# Comma-separated list of files to include.
+# Each item may be enclosed in quotes to gracefully include spaces. Items are trimmed before being loaded.
+# If the first character of an item is a question mark, the load will silently fail if the file does not exist.
+${includes} = ?"${maven.user.conf}/maven-user.properties", \
+ ?"${maven.project.conf}/maven-user.properties"
diff --git a/apache-maven/src/assembly/maven/conf/settings.xml b/apache-maven/src/assembly/maven/conf/settings.xml
new file mode 100644
index 000000000000..8082c649c136
--- /dev/null
+++ b/apache-maven/src/assembly/maven/conf/settings.xml
@@ -0,0 +1,295 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ maven-default-http-blocker
+ external:http:*
+ Pseudo repository to mirror external repositories initially using HTTP.
+ http://0.0.0.0/
+ true
+
+
+
+
+
+
+ central
+ Maven Central Repository
+ ${maven.repo.central}
+
+ false
+
+
+
+
+
+
+
+ central
+ Maven Central Repository
+ ${maven.repo.central}
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apache-maven/src/assembly/maven/conf/toolchains.xml b/apache-maven/src/assembly/maven/conf/toolchains.xml
new file mode 100644
index 000000000000..d8aa088b6a9d
--- /dev/null
+++ b/apache-maven/src/assembly/maven/conf/toolchains.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apache-maven/src/assembly/maven/lib/ext/README.txt b/apache-maven/src/assembly/maven/lib/ext/README.txt
new file mode 100644
index 000000000000..ab7f12a71284
--- /dev/null
+++ b/apache-maven/src/assembly/maven/lib/ext/README.txt
@@ -0,0 +1,2 @@
+Use this directory to add third party extensions to Maven Core. These extensions can either extend or override
+Maven's default implementation.
diff --git a/apache-maven/src/assembly/maven/lib/ext/hazelcast/README.txt b/apache-maven/src/assembly/maven/lib/ext/hazelcast/README.txt
new file mode 100644
index 000000000000..77d19b140de6
--- /dev/null
+++ b/apache-maven/src/assembly/maven/lib/ext/hazelcast/README.txt
@@ -0,0 +1,6 @@
+This directory is intended to contain Hazelcast [1] JARs for Maven Resolver Named Locks using Hazelcast.
+
+See here [2] on how to add necessary JARs.
+
+[1] https://github.com/hazelcast/hazelcast
+[2] https://maven.apache.org/resolver/maven-resolver-named-locks-hazelcast/index.html#installation-testing
diff --git a/apache-maven/src/assembly/maven/lib/ext/redisson/README.txt b/apache-maven/src/assembly/maven/lib/ext/redisson/README.txt
new file mode 100644
index 000000000000..58342b19d142
--- /dev/null
+++ b/apache-maven/src/assembly/maven/lib/ext/redisson/README.txt
@@ -0,0 +1,6 @@
+This directory is intended to contain Redisson [1] JARs for Maven Resolver Named Locks using Redisson.
+
+See here [2] on how to add necessary JARs.
+
+[1] https://github.com/redisson/redisson
+[2] https://maven.apache.org/resolver/maven-resolver-named-locks-redisson/index.html#installation-testing
diff --git a/apache-maven/src/assembly/maven/lib/jline-native/README.txt b/apache-maven/src/assembly/maven/lib/jline-native/README.txt
new file mode 100644
index 000000000000..ed74b45f7e13
--- /dev/null
+++ b/apache-maven/src/assembly/maven/lib/jline-native/README.txt
@@ -0,0 +1,8 @@
+This directory contains JLine native libraries extracted from JLine JAR.
+
+You can add your own build for platforms not natively supported by JLine.
+See here [1] on how to compile for your platform and here [2] how libraries
+follow JLine's directory and filename conventions.
+
+[1] https://github.com/jline/jline3/tree/master/native
+[2] https://github.com/jline/jline3/blob/master/native/src/main/java/org/jline/nativ/OSInfo.java
diff --git a/apache-maven/src/main/assembly/src.xml b/apache-maven/src/assembly/src.xml
similarity index 94%
rename from apache-maven/src/main/assembly/src.xml
rename to apache-maven/src/assembly/src.xml
index 9f43a0a7984e..940467421a87 100644
--- a/apache-maven/src/main/assembly/src.xml
+++ b/apache-maven/src/assembly/src.xml
@@ -17,8 +17,8 @@ specific language governing permissions and limitations
under the License.
-->
-
+srczip
diff --git a/apache-maven/src/bin/m2.conf b/apache-maven/src/bin/m2.conf
deleted file mode 100644
index 2235f820f5f0..000000000000
--- a/apache-maven/src/bin/m2.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-main is org.apache.maven.cli.MavenCli from plexus.core
-
-set maven.conf default ${maven.home}/conf
-
-[plexus.core]
-load ${maven.conf}/logging
-optionally ${maven.home}/lib/ext/*.jar
-load ${maven.home}/lib/*.jar
diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
deleted file mode 100755
index a554c661762d..000000000000
--- a/apache-maven/src/bin/mvn
+++ /dev/null
@@ -1,199 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# -----------------------------------------------------------------------------
-# Apache Maven Startup Script
-#
-# Environment Variable Prerequisites
-#
-# JAVA_HOME Must point at your Java Development Kit installation.
-# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
-# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
-# -----------------------------------------------------------------------------
-
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
- if [ -f /etc/mavenrc ] ; then
- . /etc/mavenrc
- fi
-
- if [ -f "$HOME/.mavenrc" ] ; then
- . "$HOME/.mavenrc"
- fi
-
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-mingw=false;
-case "`uname`" in
- CYGWIN*) cygwin=true;;
- MINGW*) mingw=true;;
-esac
-
-## resolve links - $0 may be a link to Maven's home
-PRG="$0"
-
-# need this for relative symlinks
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG="`dirname "$PRG"`/$link"
- fi
-done
-
-saveddir=`pwd`
-
-MAVEN_HOME=`dirname "$PRG"`/..
-
-# make it fully qualified
-MAVEN_HOME=`cd "$MAVEN_HOME" && pwd`
-
-cd "$saveddir"
-
-# For Cygwin, ensure paths are in Unix format before anything is touched
-if $cygwin ; then
- [ -n "$MAVEN_HOME" ] &&
- MAVEN_HOME=`cygpath --unix "$MAVEN_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
-fi
-
-# For MinGW, ensure paths are in Unix format before anything is touched
-if $mingw ; then
- [ -n "$MAVEN_HOME" ] &&
- MAVEN_HOME=`(cd "$MAVEN_HOME"; pwd)`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`(cd "$JAVA_HOME"; pwd)`
- # TODO classpath?
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
- JAVACMD=`which java`
-else
- JAVACMD="$JAVA_HOME/bin/java"
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
- echo "The JAVA_HOME environment variable is not defined correctly" >&2
- echo "This environment variable is needed to run this program" >&2
- echo "NB: JAVA_HOME should point to a JDK not a JRE" >&2
- exit 1
-fi
-
-CLASSWORLDS_JAR=`echo "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar`
-CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- [ -n "$MAVEN_HOME" ] &&
- MAVEN_HOME=`cygpath --path --windows "$MAVEN_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
- [ -n "$CLASSWORLDS_JAR" ] &&
- CLASSWORLDS_JAR=`cygpath --path --windows "$CLASSWORLDS_JAR"`
-fi
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
-(
- basedir=`find_file_argument_basedir "$@"`
- wdir="${basedir}"
- while [ "$wdir" != '/' ] ; do
- if [ -d "$wdir"/.mvn ] ; then
- basedir=$wdir
- break
- fi
- wdir=`cd "$wdir/.."; pwd`
- done
- echo "${basedir}"
-)
-}
-
-find_file_argument_basedir() {
-(
- basedir=`pwd`
-
- found_file_switch=0
- for arg in "$@"; do
- if [ ${found_file_switch} -eq 1 ]; then
- if [ -d "${arg}" ]; then
- basedir=`cd "${arg}" && pwd -P`
- elif [ -f "${arg}" ]; then
- basedir=`dirname "${arg}"`
- basedir=`cd "${basedir}" && pwd -P`
- if [ ! -d "${basedir}" ]; then
- echo "Directory ${basedir} extracted from the -f/--file command-line argument ${arg} does not exist" >&2
- exit 1
- fi
- else
- echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
- exit 1
- fi
- break
- fi
- if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
- found_file_switch=1
- fi
- done
- echo "${basedir}"
-)
-}
-
-# concatenates all lines of a file
-concat_lines() {
- if [ -f "$1" ]; then
- echo "`tr -s '\r\n' ' ' < "$1"`"
- fi
-}
-
-MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir "$@"`}"
-MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"
-
-# For Cygwin, switch project base directory path to Windows format before
-# executing Maven otherwise this will cause Maven not to consider it.
-if $cygwin ; then
- [ -n "$MAVEN_PROJECTBASEDIR" ] &&
- MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
-fi
-
-export MAVEN_PROJECTBASEDIR
-
-# Provide a "standardized" way to retrieve the CLI args that will
-# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
-export MAVEN_CMD_LINE_ARGS
-
-exec "$JAVACMD" \
- $MAVEN_OPTS \
- $MAVEN_DEBUG_OPTS \
- -classpath "${CLASSWORLDS_JAR}" \
- "-Dclassworlds.conf=${MAVEN_HOME}/bin/m2.conf" \
- "-Dmaven.home=${MAVEN_HOME}" \
- "-Dlibrary.jansi.path=${MAVEN_HOME}/lib/jansi-native" \
- "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${CLASSWORLDS_LAUNCHER} "$@"
diff --git a/apache-maven/src/bin/mvn.cmd b/apache-maven/src/bin/mvn.cmd
deleted file mode 100644
index fd1b21e3f9bb..000000000000
--- a/apache-maven/src/bin/mvn.cmd
+++ /dev/null
@@ -1,205 +0,0 @@
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-
-@REM -----------------------------------------------------------------------------
-@REM Apache Maven Startup Script
-@REM
-@REM Environment Variable Prerequisites
-@REM
-@REM JAVA_HOME Must point at your Java Development Kit installation.
-@REM MAVEN_BATCH_ECHO (Optional) Set to 'on' to enable the echoing of the batch commands.
-@REM MAVEN_BATCH_PAUSE (Optional) set to 'on' to wait for a key stroke before ending.
-@REM MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
-@REM MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
-@REM -----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO%
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%"=="" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat"
-if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%"=="" goto OkJHome
-for %%i in (java.exe) do set "JAVACMD=%%~$PATH:i"
-goto checkJCmd
-
-:OkJHome
-set "JAVACMD=%JAVA_HOME%\bin\java.exe"
-
-:checkJCmd
-if exist "%JAVACMD%" goto chkMHome
-
-echo The JAVA_HOME environment variable is not defined correctly >&2
-echo This environment variable is needed to run this program >&2
-echo NB: JAVA_HOME should point to a JDK not a JRE >&2
-goto error
-
-:chkMHome
-set "MAVEN_HOME=%~dp0.."
-if not "%MAVEN_HOME%"=="" goto stripMHome
-goto error
-
-:stripMHome
-if not "_%MAVEN_HOME:~-1%"=="_\" goto checkMCmd
-set "MAVEN_HOME=%MAVEN_HOME:~0,-1%"
-goto stripMHome
-
-:checkMCmd
-if exist "%MAVEN_HOME%\bin\mvn.cmd" goto init
-goto error
-@REM ==== END VALIDATION ====
-
-:init
-
-set MAVEN_CMD_LINE_ARGS=%*
-
-@REM Find the project basedir, i.e., the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set "MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%"
-if not "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set "EXEC_DIR=%CD%"
-set "WDIR=%EXEC_DIR%"
-
-@REM Look for the --file switch and start the search for the .mvn directory from the specified
-@REM POM location, if supplied.
-
-set FILE_ARG=
-:arg_loop
-if "%~1" == "-f" (
- set "FILE_ARG=%~2"
- shift
- goto process_file_arg
-)
-if "%~1" == "--file" (
- set "FILE_ARG=%~2"
- shift
- goto process_file_arg
-)
-@REM If none of the above, skip the argument
-shift
-if not "%~1" == "" (
- goto arg_loop
-) else (
- goto findBaseDir
-)
-
-:process_file_arg
-if "%FILE_ARG%" == "" (
- goto findBaseDir
-)
-if not exist "%FILE_ARG%" (
- echo POM file "%FILE_ARG%" specified the -f/--file command-line argument does not exist >&2
- goto error
-)
-if exist "%FILE_ARG%\*" (
- set "POM_DIR=%FILE_ARG%"
-) else (
- call :get_directory_from_file "%FILE_ARG%"
-)
-if not exist "%POM_DIR%" (
- echo Directory "%POM_DIR%" extracted from the -f/--file command-line argument "%FILE_ARG%" does not exist >&2
- goto error
-)
-set "WDIR=%POM_DIR%"
-goto findBaseDir
-
-:get_directory_from_file
-set "POM_DIR=%~dp1"
-:stripPomDir
-if not "_%POM_DIR:~-1%"=="_\" goto pomDirStripped
-set "POM_DIR=%POM_DIR:~0,-1%"
-goto stripPomDir
-:pomDirStripped
-exit /b
-
-:findBaseDir
-cd /d "%WDIR%"
-:findBaseDirLoop
-if exist "%WDIR%\.mvn" goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set "WDIR=%CD%"
-goto findBaseDirLoop
-
-:baseDirFound
-set "MAVEN_PROJECTBASEDIR=%WDIR%"
-cd /d "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-if "_%EXEC_DIR:~-1%"=="_\" set "EXEC_DIR=%EXEC_DIR:~0,-1%"
-set "MAVEN_PROJECTBASEDIR=%EXEC_DIR%"
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-set "jvmConfig=\.mvn\jvm.config"
-if not exist "%MAVEN_PROJECTBASEDIR%%jvmConfig%" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-for %%i in ("%MAVEN_HOME%"\boot\plexus-classworlds-*) do set CLASSWORLDS_JAR="%%i"
-set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-"%JAVACMD%" ^
- %JVM_CONFIG_MAVEN_PROPS% ^
- %MAVEN_OPTS% ^
- %MAVEN_DEBUG_OPTS% ^
- -classpath %CLASSWORLDS_JAR% ^
- "-Dclassworlds.conf=%MAVEN_HOME%\bin\m2.conf" ^
- "-Dmaven.home=%MAVEN_HOME%" ^
- "-Dlibrary.jansi.path=%MAVEN_HOME%\lib\jansi-native" ^
- "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
- %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
-if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%"=="on" pause
-
-if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
-
-cmd /C exit /B %ERROR_CODE%
diff --git a/apache-maven/src/bin/mvnDebug b/apache-maven/src/bin/mvnDebug
deleted file mode 100755
index be495ff15d38..000000000000
--- a/apache-maven/src/bin/mvnDebug
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# -----------------------------------------------------------------------------
-# Apache Maven Debug Script
-#
-# Environment Variable Prerequisites
-#
-# JAVA_HOME Must point at your Java Development Kit installation.
-# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
-# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
-# -----------------------------------------------------------------------------
-
-MAVEN_DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
-
-echo Preparing to execute Maven in debug mode
-
-env MAVEN_OPTS="$MAVEN_OPTS" MAVEN_DEBUG_OPTS="$MAVEN_DEBUG_OPTS" "`dirname "$0"`/mvn" "$@"
diff --git a/apache-maven/src/bin/mvnDebug.cmd b/apache-maven/src/bin/mvnDebug.cmd
deleted file mode 100644
index 5f9a20a0267a..000000000000
--- a/apache-maven/src/bin/mvnDebug.cmd
+++ /dev/null
@@ -1,33 +0,0 @@
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-
-@REM -----------------------------------------------------------------------------
-@REM Apache Maven Debug Script
-@REM
-@REM Environment Variable Prerequisites
-@REM
-@REM JAVA_HOME Must point at your Java Development Kit installation.
-@REM MAVEN_BATCH_ECHO (Optional) Set to 'on' to enable the echoing of the batch commands.
-@REM MAVEN_BATCH_PAUSE (Optional) set to 'on' to wait for a key stroke before ending.
-@REM MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
-@REM MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
-@REM -----------------------------------------------------------------------------
-
-@setlocal
-@set MAVEN_DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-
-@call "%~dp0"mvn.cmd %*
diff --git a/apache-maven/src/conf/logging/simplelogger.properties b/apache-maven/src/conf/logging/simplelogger.properties
deleted file mode 100644
index 64b331b4592c..000000000000
--- a/apache-maven/src/conf/logging/simplelogger.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.slf4j.simpleLogger.defaultLogLevel=info
-org.slf4j.simpleLogger.showDateTime=false
-org.slf4j.simpleLogger.showThreadName=false
-org.slf4j.simpleLogger.showLogName=false
-org.slf4j.simpleLogger.logFile=System.out
-org.slf4j.simpleLogger.cacheOutputStream=true
-org.slf4j.simpleLogger.levelInBrackets=true
-org.slf4j.simpleLogger.log.Sisu=info
-org.slf4j.simpleLogger.warnLevelString=WARNING
-
-# MNG-6181: mvn -X also prints all debug logging from HttpClient
-# Be aware that the shaded packages are used
-# org.apache.http -> org.apache.maven.wagon.providers.http.httpclient
-org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient=off
-org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient.wire=off
diff --git a/apache-maven/src/conf/settings.xml b/apache-maven/src/conf/settings.xml
deleted file mode 100644
index e27c579cf6db..000000000000
--- a/apache-maven/src/conf/settings.xml
+++ /dev/null
@@ -1,257 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/apache-maven/src/conf/toolchains.xml b/apache-maven/src/conf/toolchains.xml
deleted file mode 100644
index b2630723e7a4..000000000000
--- a/apache-maven/src/conf/toolchains.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/apache-maven/src/lib/ext/README.txt b/apache-maven/src/lib/ext/README.txt
deleted file mode 100644
index 5ebe59eb394c..000000000000
--- a/apache-maven/src/lib/ext/README.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Use this directory to contribute 3rd-party extensions to the Maven core. These extensions can either extend or override
-Maven's default implementation.
diff --git a/apache-maven/src/lib/jansi-native/README.txt b/apache-maven/src/lib/jansi-native/README.txt
deleted file mode 100644
index 22857a64efa4..000000000000
--- a/apache-maven/src/lib/jansi-native/README.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-This directory contains Jansi native libraries, extracted from Jansi jar.
-
-You can add your own extensions for platforms not natively supported by
-Jansi: the libraries follow HawtJNI directory and filename conventions.
-See http://fusesource.github.io/hawtjni/documentation/api/org/fusesource/hawtjni/runtime/Library.html
-
-See https://github.com/fusesource/jansi-native for native lib source.
diff --git a/apache-maven/src/main/appended-resources/META-INF/LICENSE.vm b/apache-maven/src/main/appended-resources/META-INF/LICENSE.vm
index 25ac46f3770f..02ddf974cf45 100644
--- a/apache-maven/src/main/appended-resources/META-INF/LICENSE.vm
+++ b/apache-maven/src/main/appended-resources/META-INF/LICENSE.vm
@@ -18,32 +18,43 @@
##
-Apache Maven includes a number of components and libraries with separate
-copyright notices and license terms. Your use of those components are
-subject to the terms and conditions of the following licenses:
+Apache Maven includes a number of components and libraries with separate
+copyright notices and license terms. Your use of those components are
+subject to the terms and conditions of the following licenses:
##
#set ( $apacheMavenGroupIds = [ "org.apache.maven", "org.apache.maven.wagon", "org.apache.maven.resolver",
"org.apache.maven.shared" ] )
-#set ( $MITLicenseNames = [ "MIT License", "MIT license", "The MIT License" ] )
+#set ( $MITLicenseNames = [ "MIT License", "MIT license", "The MIT License", "MIT" ] )
#foreach ( $project in $projects )
-#**##foreach ( $license in $project.licenses)
+#**##foreach ( $license in $project.licenses )
#* *##set ( $groupId = $project.artifact.groupId )
#* *##set ( $directory = 'lib' )
#* *##if ( !$apacheMavenGroupIds.contains( $groupId ) )
#* *### advertise about each non-Maven dependency
#* *###
-#* *### infer SPDX license code
-#* *##if ( $license.name == "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0" )
-#* *##set ( $spdx = 'CDDL-1.0' )
-#* *##elseif ( $MITLicenseNames.contains( $license.name ) )
+#* *### infer SPDX license id
+#* *##if ( $MITLicenseNames.contains( $license.name ) )
#* *##set ( $spdx = 'MIT' )
#* *##elseif ( $license.name == "Eclipse Public License, Version 1.0" )
#* *##set ( $spdx = 'EPL-1.0' )
-#* *##elseif ( $license.url.contains( "www.apache.org/licenses/LICENSE-2.0" ) )
-#* *##set ( $spdx = 'ASL-2.0' )
+#* *##elseif ( $license.name == "Eclipse Public License, Version 2.0" )
+#* *##set ( $spdx = 'EPL-2.0' )
+#* *##elseif ( $license.url.contains( "www.apache.org/licenses/LICENSE-2.0" )
+ || $license.url.contains( "https://raw.github.com/hunterhacker/jdom/master/LICENSE.txt" ) )
+#* *##set ( $spdx = 'Apache-2.0' )
+#* *##elseif ( $license.name == "BSD-2-Clause" || $license.name == "The BSD 2-Clause License"
+ || $license.url.contains( "www.opensource.org/licenses/bsd-license" ) )
+#* *##set ( $spdx = 'BSD-2-Clause' )
+#* *##elseif ( $license.name == "BSD-3-Clause"
+ || $license.url.contains( "opensource.org/licenses/BSD-3-Clause" ) )
+#* *##set ( $spdx = 'BSD-3-Clause' )
+#* *##elseif ( $license.name == "Public Domain" )
+#* *##set ( $spdx = 'Public-Domain' )
+#* *##elseif ( $license.name == "CDDL + GPLv2 with classpath exception" )
+#* *##set ( $spdx = 'CDDL+GPLv2-with-classpath-exception' )
#* *##else
#* *### unrecognized license will require analysis to know obligations
-#* *##set ( $spdx = 'unrecognized' )
+#* *##set ( $spdx = $license )
#* *##end
#* *###
#* *### fix project urls that are wrong in pom
@@ -62,19 +73,17 @@ subject to the terms and conditions of the following licenses:
#* *###
#* *### copy license file to lib/$artifactId.license
#* *##set ( $licFile = $directory + '/' + $project.artifact.artifactId + '.license' )
-#* *##if ( $spdx == "MIT" )
-#* *### MIT license contains date and copyright that makes the file specific to each artifact
-#* *##set ( $downloaded = $locator.getResourceAsFile( "licenses/${spdx}-${project.artifact.artifactId}-${project.artifact.version}.txt", "licenses/${licFile}" ) )
-#* *##else
-#* *##set ( $downloaded = $locator.getResourceAsFile( "licenses/${spdx}.txt", "licenses/${licFile}" ) )
-#* *##end
+#* *##set ( $downloaded = $locator.getResourceAsFile( "licenses/${spdx}.txt", "licenses/${licFile}" ) )
+
#* *### add dependency info to output
- $directory/${project.artifact.artifactId}-${project.artifact.version}.jar: $project.artifact.toString().replace( ':eclipse-plugin:', ':jar:' )
- $project.name
+ Project: $project.name
#if ( $project.url )Project URL: ${project.url}#end
- License: $license.name#if ( $spdx ) ($spdx)#end $license.url ($licFile)
+ License: $license.name#if ( $spdx ) ($spdx)#end
+
+ License URL: $license.url ($licFile)
#* *##end
#**##end
diff --git a/apache-maven/src/main/appended-resources/META-INF/NOTICE.vm b/apache-maven/src/main/appended-resources/META-INF/NOTICE.vm
index acf7ba42e070..dabe9f3fe9d2 100644
--- a/apache-maven/src/main/appended-resources/META-INF/NOTICE.vm
+++ b/apache-maven/src/main/appended-resources/META-INF/NOTICE.vm
@@ -18,9 +18,9 @@
##
This software bundles the following NOTICE files from third party library providers:
-META-INF/NOTICE in archive lib/guice-4.2.1-no_aop.jar
+META-INF/NOTICE in archive lib/guice-5.1.0.jar
Google Guice - Core Library
-Copyright 2006-2018 Google, Inc.
+Copyright 2006-2022 Google, Inc.
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
@@ -36,7 +36,7 @@ javolution (http://javolution.org/).
This product includes software developed by
Rome (https://rome.dev.java.net/).
-about.html in archive lib/org.eclipse.sisu.inject-0.3.4.jar
+about.html in archive lib/org.eclipse.sisu.inject-0.3.5.jar
@@ -47,27 +47,27 @@ about.html in archive lib/org.eclipse.sisu.inject-0.3.4.jar
About org.eclipse.sisu.inject
-
-
November 5, 2013
+
+
November 5, 2013
License
-
The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+
The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
at http://www.eclipse.org/legal/epl-v10.html.
For purposes of the EPL, "Program" will mean the Content.
-
If you did not receive this Content directly from the Eclipse Foundation, the Content is
+
If you did not receive this Content directly from the Eclipse Foundation, the Content is
being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
+apply to your use of any object code in the Content. Check the Redistributor's license that was
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
and such source code may be obtained at http://www.eclipse.org.
Third Party Content
-
The Content includes items that have been sourced from third parties as set
-out below. If you did not receive this Content directly from the Eclipse Foundation,
-the following is provided for informational purposes only, and you should look
+
The Content includes items that have been sourced from third parties as set
+out below. If you did not receive this Content directly from the Eclipse Foundation,
+the following is provided for informational purposes only, and you should look
to the Redistributor's license for terms and conditions of use.
ASM 4.1
diff --git a/apache-maven/src/main/appended-resources/licenses/ASL-2.0.txt b/apache-maven/src/main/appended-resources/licenses/Apache-2.0.txt
similarity index 100%
rename from apache-maven/src/main/appended-resources/licenses/ASL-2.0.txt
rename to apache-maven/src/main/appended-resources/licenses/Apache-2.0.txt
diff --git a/apache-maven/src/main/appended-resources/licenses/BSD-2-Clause.txt b/apache-maven/src/main/appended-resources/licenses/BSD-2-Clause.txt
new file mode 100644
index 000000000000..04e0d095685b
--- /dev/null
+++ b/apache-maven/src/main/appended-resources/licenses/BSD-2-Clause.txt
@@ -0,0 +1,24 @@
+Copyright
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/apache-maven/src/main/appended-resources/licenses/BSD-3-Clause.txt b/apache-maven/src/main/appended-resources/licenses/BSD-3-Clause.txt
new file mode 100644
index 000000000000..fdc6a97e5fd9
--- /dev/null
+++ b/apache-maven/src/main/appended-resources/licenses/BSD-3-Clause.txt
@@ -0,0 +1,28 @@
+Copyright
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/apache-maven/src/main/appended-resources/licenses/CDDL+GPLv2-with-classpath-exception.txt b/apache-maven/src/main/appended-resources/licenses/CDDL+GPLv2-with-classpath-exception.txt
new file mode 100644
index 000000000000..b1c74f95ede8
--- /dev/null
+++ b/apache-maven/src/main/appended-resources/licenses/CDDL+GPLv2-with-classpath-exception.txt
@@ -0,0 +1,759 @@
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
+
+1. Definitions.
+
+ 1.1. "Contributor" means each individual or entity that creates or
+ contributes to the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original
+ Software, prior Modifications used by a Contributor (if any), and
+ the Modifications made by that particular Contributor.
+
+ 1.3. "Covered Software" means (a) the Original Software, or (b)
+ Modifications, or (c) the combination of files containing Original
+ Software with files containing Modifications, in each case including
+ portions thereof.
+
+ 1.4. "Executable" means the Covered Software in any form other than
+ Source Code.
+
+ 1.5. "Initial Developer" means the individual or entity that first
+ makes Original Software available under this License.
+
+ 1.6. "Larger Work" means a work which combines Covered Software or
+ portions thereof with code not governed by the terms of this License.
+
+ 1.7. "License" means this document.
+
+ 1.8. "Licensable" means having the right to grant, to the maximum
+ extent possible, whether at the time of the initial grant or
+ subsequently acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means the Source Code and Executable form of
+ any of the following:
+
+ A. Any file that results from an addition to, deletion from or
+ modification of the contents of a file containing Original Software
+ or previous Modifications;
+
+ B. Any new file that contains any part of the Original Software or
+ previous Modification; or
+
+ C. Any new file that is contributed or otherwise made available
+ under the terms of this License.
+
+ 1.10. "Original Software" means the Source Code and Executable form
+ of computer software code that is originally released under this
+ License.
+
+ 1.11. "Patent Claims" means any patent claim(s), now owned or
+ hereafter acquired, including without limitation, method, process,
+ and apparatus claims, in any patent Licensable by grantor.
+
+ 1.12. "Source Code" means (a) the common form of computer software
+ code in which modifications are made and (b) associated
+ documentation included in or with such code.
+
+ 1.13. "You" (or "Your") means an individual or a legal entity
+ exercising rights under, and complying with all of the terms of,
+ this License. For legal entities, "You" includes any entity which
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants.
+
+ 2.1. The Initial Developer Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and subject
+ to third party intellectual property claims, the Initial Developer
+ hereby grants You a world-wide, royalty-free, non-exclusive license:
+
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Initial Developer, to use, reproduce,
+ modify, display, perform, sublicense and distribute the Original
+ Software (or portions thereof), with or without Modifications,
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using or selling of
+ Original Software, to make, have made, use, practice, sell, and
+ offer for sale, and/or otherwise dispose of the Original Software
+ (or portions thereof).
+
+ (c) The licenses granted in Sections 2.1(a) and (b) are effective on
+ the date Initial Developer first distributes or otherwise makes the
+ Original Software available to a third party under the terms of this
+ License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+ granted: (1) for code that You delete from the Original Software, or
+ (2) for infringements caused by: (i) the modification of the
+ Original Software, or (ii) the combination of the Original Software
+ with other software or devices.
+
+ 2.2. Contributor Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and subject
+ to third party intellectual property claims, each Contributor hereby
+ grants You a world-wide, royalty-free, non-exclusive license:
+
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Contributor to use, reproduce, modify,
+ display, perform, sublicense and distribute the Modifications
+ created by such Contributor (or portions thereof), either on an
+ unmodified basis, with other Modifications, as Covered Software
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or selling
+ of Modifications made by that Contributor either alone and/or in
+ combination with its Contributor Version (or portions of such
+ combination), to make, use, sell, offer for sale, have made, and/or
+ otherwise dispose of: (1) Modifications made by that Contributor (or
+ portions thereof); and (2) the combination of Modifications made by
+ that Contributor with its Contributor Version (or portions of such
+ combination).
+
+ (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective
+ on the date Contributor first distributes or otherwise makes the
+ Modifications available to a third party.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+ granted: (1) for any code that Contributor has deleted from the
+ Contributor Version; (2) for infringements caused by: (i) third
+ party modifications of Contributor Version, or (ii) the combination
+ of Modifications made by that Contributor with other software
+ (except as part of the Contributor Version) or other devices; or (3)
+ under Patent Claims infringed by Covered Software in the absence of
+ Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+ 3.1. Availability of Source Code.
+
+ Any Covered Software that You distribute or otherwise make available
+ in Executable form must also be made available in Source Code form
+ and that Source Code form must be distributed only under the terms
+ of this License. You must include a copy of this License with every
+ copy of the Source Code form of the Covered Software You distribute
+ or otherwise make available. You must inform recipients of any such
+ Covered Software in Executable form as to how they can obtain such
+ Covered Software in Source Code form in a reasonable manner on or
+ through a medium customarily used for software exchange.
+
+ 3.2. Modifications.
+
+ The Modifications that You create or to which You contribute are
+ governed by the terms of this License. You represent that You
+ believe Your Modifications are Your original creation(s) and/or You
+ have sufficient rights to grant the rights conveyed by this License.
+
+ 3.3. Required Notices.
+
+ You must include a notice in each of Your Modifications that
+ identifies You as the Contributor of the Modification. You may not
+ remove or alter any copyright, patent or trademark notices contained
+ within the Covered Software, or any notices of licensing or any
+ descriptive text giving attribution to any Contributor or the
+ Initial Developer.
+
+ 3.4. Application of Additional Terms.
+
+ You may not offer or impose any terms on any Covered Software in
+ Source Code form that alters or restricts the applicable version of
+ this License or the recipients' rights hereunder. You may choose to
+ offer, and to charge a fee for, warranty, support, indemnity or
+ liability obligations to one or more recipients of Covered Software.
+ However, you may do so only on Your own behalf, and not on behalf of
+ the Initial Developer or any Contributor. You must make it
+ absolutely clear that any such warranty, support, indemnity or
+ liability obligation is offered by You alone, and You hereby agree
+ to indemnify the Initial Developer and every Contributor for any
+ liability incurred by the Initial Developer or such Contributor as a
+ result of warranty, support, indemnity or liability terms You offer.
+
+ 3.5. Distribution of Executable Versions.
+
+ You may distribute the Executable form of the Covered Software under
+ the terms of this License or under the terms of a license of Your
+ choice, which may contain terms different from this License,
+ provided that You are in compliance with the terms of this License
+ and that the license for the Executable form does not attempt to
+ limit or alter the recipient's rights in the Source Code form from
+ the rights set forth in this License. If You distribute the Covered
+ Software in Executable form under a different license, You must make
+ it absolutely clear that any terms which differ from this License
+ are offered by You alone, not by the Initial Developer or
+ Contributor. You hereby agree to indemnify the Initial Developer and
+ every Contributor for any liability incurred by the Initial
+ Developer or such Contributor as a result of any such terms You offer.
+
+ 3.6. Larger Works.
+
+ You may create a Larger Work by combining Covered Software with
+ other code not governed by the terms of this License and distribute
+ the Larger Work as a single product. In such a case, You must make
+ sure the requirements of this License are fulfilled for the Covered
+ Software.
+
+4. Versions of the License.
+
+ 4.1. New Versions.
+
+ Oracle is the initial license steward and may publish revised and/or
+ new versions of this License from time to time. Each version will be
+ given a distinguishing version number. Except as provided in Section
+ 4.3, no one other than the license steward has the right to modify
+ this License.
+
+ 4.2. Effect of New Versions.
+
+ You may always continue to use, distribute or otherwise make the
+ Covered Software available under the terms of the version of the
+ License under which You originally received the Covered Software. If
+ the Initial Developer includes a notice in the Original Software
+ prohibiting it from being distributed or otherwise made available
+ under any subsequent version of the License, You must distribute and
+ make the Covered Software available under the terms of the version
+ of the License under which You originally received the Covered
+ Software. Otherwise, You may also choose to use, distribute or
+ otherwise make the Covered Software available under the terms of any
+ subsequent version of the License published by the license steward.
+
+ 4.3. Modified Versions.
+
+ When You are an Initial Developer and You want to create a new
+ license for Your Original Software, You may create and use a
+ modified version of this License if You: (a) rename the license and
+ remove any references to the name of the license steward (except to
+ note that the license differs from this License); and (b) otherwise
+ make it clear that the license contains terms which differ from this
+ License.
+
+5. DISCLAIMER OF WARRANTY.
+
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE
+ IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR
+ NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF
+ THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE
+ DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
+ OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING,
+ REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS
+ AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+6. TERMINATION.
+
+ 6.1. This License and the rights granted hereunder will terminate
+ automatically if You fail to comply with terms herein and fail to
+ cure such breach within 30 days of becoming aware of the breach.
+ Provisions which, by their nature, must remain in effect beyond the
+ termination of this License shall survive.
+
+ 6.2. If You assert a patent infringement claim (excluding
+ declaratory judgment actions) against Initial Developer or a
+ Contributor (the Initial Developer or Contributor against whom You
+ assert such claim is referred to as "Participant") alleging that the
+ Participant Software (meaning the Contributor Version where the
+ Participant is a Contributor or the Original Software where the
+ Participant is the Initial Developer) directly or indirectly
+ infringes any patent, then any and all rights granted directly or
+ indirectly to You by such Participant, the Initial Developer (if the
+ Initial Developer is not the Participant) and all Contributors under
+ Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice
+ from Participant terminate prospectively and automatically at the
+ expiration of such 60 day notice period, unless if within such 60
+ day period You withdraw Your claim with respect to the Participant
+ Software against such Participant either unilaterally or pursuant to
+ a written agreement with Participant.
+
+ 6.3. If You assert a patent infringement claim against Participant
+ alleging that the Participant Software directly or indirectly
+ infringes any patent where such claim is resolved (such as by
+ license or settlement) prior to the initiation of patent
+ infringement litigation, then the reasonable value of the licenses
+ granted by such Participant under Sections 2.1 or 2.2 shall be taken
+ into account in determining the amount or value of any payment or
+ license.
+
+ 6.4. In the event of termination under Sections 6.1 or 6.2 above,
+ all end user licenses that have been validly granted by You or any
+ distributor hereunder prior to termination (excluding licenses
+ granted to You by any distributor) shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE
+ TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+ LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
+ FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR
+ LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE
+ POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT
+ APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH
+ PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH
+ LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
+ LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION
+ AND LIMITATION MAY NOT APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+ The Covered Software is a "commercial item," as that term is defined
+ in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
+ software" (as that term is defined at 48 C.F.R. §
+ 252.227-7014(a)(1)) and "commercial computer software documentation"
+ as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent
+ with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4
+ (June 1995), all U.S. Government End Users acquire Covered Software
+ with only those rights set forth herein. This U.S. Government Rights
+ clause is in lieu of, and supersedes, any other FAR, DFAR, or other
+ clause or provision that addresses Government rights in computer
+ software under this License.
+
+9. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the extent
+ necessary to make it enforceable. This License shall be governed by
+ the law of the jurisdiction specified in a notice contained within
+ the Original Software (except to the extent applicable law, if any,
+ provides otherwise), excluding such jurisdiction's conflict-of-law
+ provisions. Any litigation relating to this License shall be subject
+ to the jurisdiction of the courts located in the jurisdiction and
+ venue specified in a notice contained within the Original Software,
+ with the losing party responsible for costs, including, without
+ limitation, court costs and reasonable attorneys' fees and expenses.
+ The application of the United Nations Convention on Contracts for
+ the International Sale of Goods is expressly excluded. Any law or
+ regulation which provides that the language of a contract shall be
+ construed against the drafter shall not apply to this License. You
+ agree that You alone are responsible for compliance with the United
+ States export administration regulations (and the export control
+ laws and regulation of any other countries) when You use, distribute
+ or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or indirectly,
+ out of its utilization of rights under this License and You agree to
+ work with Initial Developer and Contributors to distribute such
+ responsibility on an equitable basis. Nothing herein is intended or
+ shall be deemed to constitute any admission of liability.
+
+------------------------------------------------------------------------
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION
+LICENSE (CDDL)
+
+The code released under the CDDL shall be governed by the laws of the
+State of California (excluding conflict-of-law provisions). Any
+litigation relating to this License shall be subject to the jurisdiction
+of the Federal Courts of the Northern District of California and the
+state courts of the State of California, with venue lying in Santa Clara
+County, California.
+
+
+
+ The GNU General Public License (GPL) Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor
+Boston, MA 02110-1335
+USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to
+share and change it. By contrast, the GNU General Public License is
+intended to guarantee your freedom to share and change free software--to
+make sure the software is free for all its users. This General Public
+License applies to most of the Free Software Foundation's software and
+to any other program whose authors commit to using it. (Some other Free
+Software Foundation software is covered by the GNU Library General
+Public License instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price.
+Our General Public Licenses are designed to make sure that you have the
+freedom to distribute copies of free software (and charge for this
+service if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone
+to deny you these rights or to ask you to surrender the rights. These
+restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis
+or for a fee, you must give the recipients all the rights that you have.
+You must make sure that they, too, receive or can get the source code.
+And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+Finally, any free program is threatened constantly by software patents.
+We wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program
+proprietary. To prevent this, we have made it clear that any patent must
+be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a
+notice placed by the copyright holder saying it may be distributed under
+the terms of this General Public License. The "Program", below, refers
+to any such program or work, and a "work based on the Program" means
+either the Program or any derivative work under copyright law: that is
+to say, a work containing the Program or a portion of it, either
+verbatim or with modifications and/or translated into another language.
+(Hereinafter, translation is included without limitation in the term
+"modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of running
+the Program is not restricted, and the output from the Program is
+covered only if its contents constitute a work based on the Program
+(independent of having been made by running the Program). Whether that
+is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source
+code as you receive it, in any medium, provided that you conspicuously
+and appropriately publish on each copy an appropriate copyright notice
+and disclaimer of warranty; keep intact all the notices that refer to
+this License and to the absence of any warranty; and give any other
+recipients of the Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of
+it, thus forming a work based on the Program, and copy and distribute
+such modifications or work under the terms of Section 1 above, provided
+that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any part
+ thereof, to be licensed as a whole at no charge to all third parties
+ under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a notice
+ that there is no warranty (or else, saying that you provide a
+ warranty) and that users may redistribute the program under these
+ conditions, and telling the user how to view a copy of this License.
+ (Exception: if the Program itself is interactive but does not
+ normally print such an announcement, your work based on the Program
+ is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program, and
+can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based on
+the Program, the distribution of the whole must be on the terms of this
+License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of a
+storage or distribution medium does not bring the other work under the
+scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections 1
+ and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your cost
+ of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer to
+ distribute corresponding source code. (This alternative is allowed
+ only for noncommercial distribution and only if you received the
+ program in object code or executable form with such an offer, in
+ accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source code
+means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to control
+compilation and installation of the executable. However, as a special
+exception, the source code distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies the
+executable.
+
+If distribution of executable or object code is made by offering access
+to copy from a designated place, then offering equivalent access to copy
+the source code from the same place counts as distribution of the source
+code, even though third parties are not compelled to copy the source
+along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt otherwise
+to copy, modify, sublicense or distribute the Program is void, and will
+automatically terminate your rights under this License. However, parties
+who have received copies, or rights, from you under this License will
+not have their licenses terminated so long as such parties remain in
+full compliance.
+
+5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and all
+its terms and conditions for copying, distributing or modifying the
+Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further restrictions
+on the recipients' exercise of the rights granted herein. You are not
+responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot distribute
+so as to satisfy simultaneously your obligations under this License and
+any other pertinent obligations, then as a consequence you may not
+distribute the Program at all. For example, if a patent license would
+not permit royalty-free redistribution of the Program by all those who
+receive copies directly or indirectly through you, then the only way you
+could satisfy both it and this License would be to refrain entirely from
+distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is implemented
+by public license practices. Many people have made generous
+contributions to the wide range of software distributed through that
+system in reliance on consistent application of that system; it is up to
+the author/donor to decide if he or she is willing to distribute
+software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be
+a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License may
+add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among countries
+not thus excluded. In such case, this License incorporates the
+limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new
+versions of the General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Program does not specify a version
+number of this License, you may choose any version ever published by the
+Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the
+author to ask for permission. For software which is copyrighted by the
+Free Software Foundation, write to the Free Software Foundation; we
+sometimes make exceptions for this. Our decision will be guided by the
+two goals of preserving the free status of all derivatives of our free
+software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH
+YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
+DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
+DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
+INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
+THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR
+OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to
+attach them to the start of each source file to most effectively convey
+the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ One line to give the program's name and a brief idea of what it does.
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type
+ `show w'. This is free software, and you are welcome to redistribute
+ it under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the
+appropriate parts of the General Public License. Of course, the commands
+you use may be called something other than `show w' and `show c'; they
+could even be mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ program `Gnomovision' (which makes passes at compilers) written by
+ James Hacker.
+
+ signature of Ty Coon, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications
+with the library. If this is what you want to do, use the GNU Library
+General Public License instead of this License.
+
+#
+
+Certain source files distributed by Oracle America, Inc. and/or its
+affiliates are subject to the following clarification and special
+exception to the GPLv2, based on the GNU Project exception for its
+Classpath libraries, known as the GNU Classpath Exception, but only
+where Oracle has expressly included in the particular source file's
+header the words "Oracle designates this particular file as subject to
+the "Classpath" exception as provided by Oracle in the LICENSE file
+that accompanied this code."
+
+You should also note that Oracle includes multiple, independent
+programs in this software package. Some of those programs are provided
+under licenses deemed incompatible with the GPLv2 by the Free Software
+Foundation and others. For example, the package includes programs
+licensed under the Apache License, Version 2.0. Such programs are
+licensed to you under their original licenses.
+
+Oracle facilitates your further distribution of this package by adding
+the Classpath Exception to the necessary parts of its GPLv2 code, which
+permits you to use that code in combination with other independent
+modules not licensed under the GPLv2. However, note that this would
+not permit you to commingle code under an incompatible license with
+Oracle's GPLv2 licensed code by, for example, cutting and pasting such
+code into a file also containing Oracle's GPLv2 licensed code and then
+distributing the result. Additionally, if you were to remove the
+Classpath Exception from any of the files to which it applies and
+distribute the result, you would likely be required to license some or
+all of the other code in that distribution under the GPLv2 as well, and
+since the GPLv2 is incompatible with the license terms of some items
+included in the distribution by Oracle, removing the Classpath
+Exception could therefore effectively compromise your ability to
+further distribute the package.
+
+Proceed with caution and we recommend that you obtain the advice of a
+lawyer skilled in open source matters before removing the Classpath
+Exception or making modifications to this package which may
+subsequently be redistributed and/or involve the use of third party
+software.
+
+CLASSPATH EXCEPTION
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License version 2 cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from or
+based on this library. If you modify this library, you may extend this
+exception to your version of the library, but you are not obligated to
+do so. If you do not wish to do so, delete this exception statement
+from your version.
diff --git a/apache-maven/src/main/appended-resources/licenses/CDDL-1.0.txt b/apache-maven/src/main/appended-resources/licenses/CDDL-1.0.txt
deleted file mode 100644
index 9bc6342e22c9..000000000000
--- a/apache-maven/src/main/appended-resources/licenses/CDDL-1.0.txt
+++ /dev/null
@@ -1,384 +0,0 @@
-COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
-
-
- 1. Definitions.
-
- 1.1. "Contributor" means each individual or entity that
- creates or contributes to the creation of Modifications.
-
- 1.2. "Contributor Version" means the combination of the
- Original Software, prior Modifications used by a
- Contributor (if any), and the Modifications made by that
- particular Contributor.
-
- 1.3. "Covered Software" means (a) the Original Software, or
- (b) Modifications, or (c) the combination of files
- containing Original Software with files containing
- Modifications, in each case including portions thereof.
-
- 1.4. "Executable" means the Covered Software in any form
- other than Source Code.
-
- 1.5. "Initial Developer" means the individual or entity
- that first makes Original Software available under this
- License.
-
- 1.6. "Larger Work" means a work which combines Covered
- Software or portions thereof with code not governed by the
- terms of this License.
-
- 1.7. "License" means this document.
-
- 1.8. "Licensable" means having the right to grant, to the
- maximum extent possible, whether at the time of the initial
- grant or subsequently acquired, any and all of the rights
- conveyed herein.
-
- 1.9. "Modifications" means the Source Code and Executable
- form of any of the following:
-
- A. Any file that results from an addition to,
- deletion from or modification of the contents of a
- file containing Original Software or previous
- Modifications;
-
- B. Any new file that contains any part of the
- Original Software or previous Modification; or
-
- C. Any new file that is contributed or otherwise made
- available under the terms of this License.
-
- 1.10. "Original Software" means the Source Code and
- Executable form of computer software code that is
- originally released under this License.
-
- 1.11. "Patent Claims" means any patent claim(s), now owned
- or hereafter acquired, including without limitation,
- method, process, and apparatus claims, in any patent
- Licensable by grantor.
-
- 1.12. "Source Code" means (a) the common form of computer
- software code in which modifications are made and (b)
- associated documentation included in or with such code.
-
- 1.13. "You" (or "Your") means an individual or a legal
- entity exercising rights under, and complying with all of
- the terms of, this License. For legal entities, "You"
- includes any entity which controls, is controlled by, or is
- under common control with You. For purposes of this
- definition, "control" means (a) the power, direct or
- indirect, to cause the direction or management of such
- entity, whether by contract or otherwise, or (b) ownership
- of more than fifty percent (50%) of the outstanding shares
- or beneficial ownership of such entity.
-
- 2. License Grants.
-
- 2.1. The Initial Developer Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, the
- Initial Developer hereby grants You a world-wide,
- royalty-free, non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Initial Developer,
- to use, reproduce, modify, display, perform,
- sublicense and distribute the Original Software (or
- portions thereof), with or without Modifications,
- and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using or selling of Original Software, to make, have
- made, use, practice, sell, and offer for sale, and/or
- otherwise dispose of the Original Software (or
- portions thereof).
-
- (c) The licenses granted in Sections 2.1(a) and (b)
- are effective on the date Initial Developer first
- distributes or otherwise makes the Original Software
- available to a third party under the terms of this
- License.
-
- (d) Notwithstanding Section 2.1(b) above, no patent
- license is granted: (1) for code that You delete from
- the Original Software, or (2) for infringements
- caused by: (i) the modification of the Original
- Software, or (ii) the combination of the Original
- Software with other software or devices.
-
- 2.2. Contributor Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, each
- Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Contributor to
- use, reproduce, modify, display, perform, sublicense
- and distribute the Modifications created by such
- Contributor (or portions thereof), either on an
- unmodified basis, with other Modifications, as
- Covered Software and/or as part of a Larger Work; and
-
-
- (b) under Patent Claims infringed by the making,
- using, or selling of Modifications made by that
- Contributor either alone and/or in combination with
- its Contributor Version (or portions of such
- combination), to make, use, sell, offer for sale,
- have made, and/or otherwise dispose of: (1)
- Modifications made by that Contributor (or portions
- thereof); and (2) the combination of Modifications
- made by that Contributor with its Contributor Version
- (or portions of such combination).
-
- (c) The licenses granted in Sections 2.2(a) and
- 2.2(b) are effective on the date Contributor first
- distributes or otherwise makes the Modifications
- available to a third party.
-
- (d) Notwithstanding Section 2.2(b) above, no patent
- license is granted: (1) for any code that Contributor
- has deleted from the Contributor Version; (2) for
- infringements caused by: (i) third party
- modifications of Contributor Version, or (ii) the
- combination of Modifications made by that Contributor
- with other software (except as part of the
- Contributor Version) or other devices; or (3) under
- Patent Claims infringed by Covered Software in the
- absence of Modifications made by that Contributor.
-
- 3. Distribution Obligations.
-
- 3.1. Availability of Source Code.
-
- Any Covered Software that You distribute or otherwise make
- available in Executable form must also be made available in
- Source Code form and that Source Code form must be
- distributed only under the terms of this License. You must
- include a copy of this License with every copy of the
- Source Code form of the Covered Software You distribute or
- otherwise make available. You must inform recipients of any
- such Covered Software in Executable form as to how they can
- obtain such Covered Software in Source Code form in a
- reasonable manner on or through a medium customarily used
- for software exchange.
-
- 3.2. Modifications.
-
- The Modifications that You create or to which You
- contribute are governed by the terms of this License. You
- represent that You believe Your Modifications are Your
- original creation(s) and/or You have sufficient rights to
- grant the rights conveyed by this License.
-
- 3.3. Required Notices.
-
- You must include a notice in each of Your Modifications
- that identifies You as the Contributor of the Modification.
- You may not remove or alter any copyright, patent or
- trademark notices contained within the Covered Software, or
- any notices of licensing or any descriptive text giving
- attribution to any Contributor or the Initial Developer.
-
- 3.4. Application of Additional Terms.
-
- You may not offer or impose any terms on any Covered
- Software in Source Code form that alters or restricts the
- applicable version of this License or the recipients"
- rights hereunder. You may choose to offer, and to charge a
- fee for, warranty, support, indemnity or liability
- obligations to one or more recipients of Covered Software.
- However, you may do so only on Your own behalf, and not on
- behalf of the Initial Developer or any Contributor. You
- must make it absolutely clear that any such warranty,
- support, indemnity or liability obligation is offered by
- You alone, and You hereby agree to indemnify the Initial
- Developer and every Contributor for any liability incurred
- by the Initial Developer or such Contributor as a result of
- warranty, support, indemnity or liability terms You offer.
-
-
- 3.5. Distribution of Executable Versions.
-
- You may distribute the Executable form of the Covered
- Software under the terms of this License or under the terms
- of a license of Your choice, which may contain terms
- different from this License, provided that You are in
- compliance with the terms of this License and that the
- license for the Executable form does not attempt to limit
- or alter the recipient"s rights in the Source Code form
- from the rights set forth in this License. If You
- distribute the Covered Software in Executable form under a
- different license, You must make it absolutely clear that
- any terms which differ from this License are offered by You
- alone, not by the Initial Developer or Contributor. You
- hereby agree to indemnify the Initial Developer and every
- Contributor for any liability incurred by the Initial
- Developer or such Contributor as a result of any such terms
- You offer.
-
- 3.6. Larger Works.
-
- You may create a Larger Work by combining Covered Software
- with other code not governed by the terms of this License
- and distribute the Larger Work as a single product. In such
- a case, You must make sure the requirements of this License
- are fulfilled for the Covered Software.
-
- 4. Versions of the License.
-
- 4.1. New Versions.
-
- Sun Microsystems, Inc. is the initial license steward and
- may publish revised and/or new versions of this License
- from time to time. Each version will be given a
- distinguishing version number. Except as provided in
- Section 4.3, no one other than the license steward has the
- right to modify this License.
-
- 4.2. Effect of New Versions.
-
- You may always continue to use, distribute or otherwise
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. If the Initial Developer includes a
- notice in the Original Software prohibiting it from being
- distributed or otherwise made available under any
- subsequent version of the License, You must distribute and
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. Otherwise, You may also choose to
- use, distribute or otherwise make the Covered Software
- available under the terms of any subsequent version of the
- License published by the license steward.
-
- 4.3. Modified Versions.
-
- When You are an Initial Developer and You want to create a
- new license for Your Original Software, You may create and
- use a modified version of this License if You: (a) rename
- the license and remove any references to the name of the
- license steward (except to note that the license differs
- from this License); and (b) otherwise make it clear that
- the license contains terms which differ from this License.
-
-
- 5. DISCLAIMER OF WARRANTY.
-
- COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
- BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
- INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
- SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
- PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
- PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
- COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
- INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
- ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
- WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
- ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
- DISCLAIMER.
-
- 6. TERMINATION.
-
- 6.1. This License and the rights granted hereunder will
- terminate automatically if You fail to comply with terms
- herein and fail to cure such breach within 30 days of
- becoming aware of the breach. Provisions which, by their
- nature, must remain in effect beyond the termination of
- this License shall survive.
-
- 6.2. If You assert a patent infringement claim (excluding
- declaratory judgment actions) against Initial Developer or
- a Contributor (the Initial Developer or Contributor against
- whom You assert such claim is referred to as "Participant")
- alleging that the Participant Software (meaning the
- Contributor Version where the Participant is a Contributor
- or the Original Software where the Participant is the
- Initial Developer) directly or indirectly infringes any
- patent, then any and all rights granted directly or
- indirectly to You by such Participant, the Initial
- Developer (if the Initial Developer is not the Participant)
- and all Contributors under Sections 2.1 and/or 2.2 of this
- License shall, upon 60 days notice from Participant
- terminate prospectively and automatically at the expiration
- of such 60 day notice period, unless if within such 60 day
- period You withdraw Your claim with respect to the
- Participant Software against such Participant either
- unilaterally or pursuant to a written agreement with
- Participant.
-
- 6.3. In the event of termination under Sections 6.1 or 6.2
- above, all end user licenses that have been validly granted
- by You or any distributor hereunder prior to termination
- (excluding licenses granted to You by any distributor)
- shall survive termination.
-
- 7. LIMITATION OF LIABILITY.
-
- UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
- (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
- INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
- COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
- LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
- CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
- LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
- STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
- COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
- INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
- LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
- INJURY RESULTING FROM SUCH PARTY"S NEGLIGENCE TO THE EXTENT
- APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
- NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
- CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
- APPLY TO YOU.
-
- 8. U.S. GOVERNMENT END USERS.
-
- The Covered Software is a "commercial item," as that term is
- defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
- computer software" (as that term is defined at 48 C.F.R. "
- 252.227-7014(a)(1)) and "commercial computer software
- documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
- 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
- through 227.7202-4 (June 1995), all U.S. Government End Users
- acquire Covered Software with only those rights set forth herein.
- This U.S. Government Rights clause is in lieu of, and supersedes,
- any other FAR, DFAR, or other clause or provision that addresses
- Government rights in computer software under this License.
-
- 9. MISCELLANEOUS.
-
- This License represents the complete agreement concerning subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the
- extent necessary to make it enforceable. This License shall be
- governed by the law of the jurisdiction specified in a notice
- contained within the Original Software (except to the extent
- applicable law, if any, provides otherwise), excluding such
- jurisdiction"s conflict-of-law provisions. Any litigation
- relating to this License shall be subject to the jurisdiction of
- the courts located in the jurisdiction and venue specified in a
- notice contained within the Original Software, with the losing
- party responsible for costs, including, without limitation, court
- costs and reasonable attorneys" fees and expenses. The
- application of the United Nations Convention on Contracts for the
- International Sale of Goods is expressly excluded. Any law or
- regulation which provides that the language of a contract shall
- be construed against the drafter shall not apply to this License.
- You agree that You alone are responsible for compliance with the
- United States export administration regulations (and the export
- control laws and regulation of any other countries) when You use,
- distribute or otherwise make available any Covered Software.
-
- 10. RESPONSIBILITY FOR CLAIMS.
-
- As between Initial Developer and the Contributors, each party is
- responsible for claims and damages arising, directly or
- indirectly, out of its utilization of rights under this License
- and You agree to work with Initial Developer and Contributors to
- distribute such responsibility on an equitable basis. Nothing
- herein is intended or shall be deemed to constitute any admission
- of liability.
diff --git a/apache-maven/src/main/appended-resources/licenses/EPL-2.0.txt b/apache-maven/src/main/appended-resources/licenses/EPL-2.0.txt
new file mode 100644
index 000000000000..e55f34467e25
--- /dev/null
+++ b/apache-maven/src/main/appended-resources/licenses/EPL-2.0.txt
@@ -0,0 +1,277 @@
+Eclipse Public License - v 2.0
+
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+ PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+ OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+ a) in the case of the initial Contributor, the initial content
+ Distributed under this Agreement, and
+
+ b) in the case of each subsequent Contributor:
+ i) changes to the Program, and
+ ii) additions to the Program;
+ where such changes and/or additions to the Program originate from
+ and are Distributed by that particular Contributor. A Contribution
+ "originates" from a Contributor if it was added to the Program by
+ such Contributor itself or anyone acting on such Contributor's behalf.
+ Contributions do not include changes or additions to the Program that
+ are not Modified Works.
+
+"Contributor" means any person or entity that Distributes the Program.
+
+"Licensed Patents" mean patent claims licensable by a Contributor which
+are necessarily infringed by the use or sale of its Contribution alone
+or when combined with the Program.
+
+"Program" means the Contributions Distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement
+or any Secondary License (as applicable), including Contributors.
+
+"Derivative Works" shall mean any work, whether in Source Code or other
+form, that is based on (or derived from) the Program and for which the
+editorial revisions, annotations, elaborations, or other modifications
+represent, as a whole, an original work of authorship.
+
+"Modified Works" shall mean any work in Source Code or other form that
+results from an addition to, deletion from, or modification of the
+contents of the Program, including, for purposes of clarity any new file
+in Source Code form that contains any contents of the Program. Modified
+Works shall not include works that contain only declarations,
+interfaces, types, classes, structures, or files of the Program solely
+in each case in order to link to, bind by name, or subclass the Program
+or Modified Works thereof.
+
+"Distribute" means the acts of a) distributing or b) making available
+in any manner that enables the transfer of a copy.
+
+"Source Code" means the form of a Program preferred for making
+modifications, including but not limited to software source code,
+documentation source, and configuration files.
+
+"Secondary License" means either the GNU General Public License,
+Version 2.0, or any later versions of that license, including any
+exceptions or additional permissions as identified by the initial
+Contributor.
+
+2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free copyright
+ license to reproduce, prepare Derivative Works of, publicly display,
+ publicly perform, Distribute and sublicense the Contribution of such
+ Contributor, if any, and such Derivative Works.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such Contributor,
+ if any, in Source Code or other form. This patent license shall
+ apply to the combination of the Contribution and the Program if, at
+ the time the Contribution is added by the Contributor, such addition
+ of the Contribution causes such combination to be covered by the
+ Licensed Patents. The patent license shall not apply to any other
+ combinations which include the Contribution. No hardware per se is
+ licensed hereunder.
+
+ c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe the
+ patent or other intellectual property rights of any other entity.
+ Each Contributor disclaims any liability to Recipient for claims
+ brought by any other entity based on infringement of intellectual
+ property rights or otherwise. As a condition to exercising the
+ rights and licenses granted hereunder, each Recipient hereby
+ assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party
+ patent license is required to allow Recipient to Distribute the
+ Program, it is Recipient's responsibility to acquire that license
+ before distributing the Program.
+
+ d) Each Contributor represents that to its knowledge it has
+ sufficient copyright rights in its Contribution, if any, to grant
+ the copyright license set forth in this Agreement.
+
+ e) Notwithstanding the terms of any Secondary License, no
+ Contributor makes additional grants to any Recipient (other than
+ those set forth in this Agreement) as a result of such Recipient's
+ receipt of the Program under the terms of a Secondary License
+ (if permitted under the terms of Section 3).
+
+3. REQUIREMENTS
+
+3.1 If a Contributor Distributes the Program in any form, then:
+
+ a) the Program must also be made available as Source Code, in
+ accordance with section 3.2, and the Contributor must accompany
+ the Program with a statement that the Source Code for the Program
+ is available under this Agreement, and informs Recipients how to
+ obtain it in a reasonable manner on or through a medium customarily
+ used for software exchange; and
+
+ b) the Contributor may Distribute the Program under a license
+ different than this Agreement, provided that such license:
+ i) effectively disclaims on behalf of all other Contributors all
+ warranties and conditions, express and implied, including
+ warranties or conditions of title and non-infringement, and
+ implied warranties or conditions of merchantability and fitness
+ for a particular purpose;
+
+ ii) effectively excludes on behalf of all other Contributors all
+ liability for damages, including direct, indirect, special,
+ incidental and consequential damages, such as lost profits;
+
+ iii) does not attempt to limit or alter the recipients' rights
+ in the Source Code under section 3.2; and
+
+ iv) requires any subsequent distribution of the Program by any
+ party to be under a license that satisfies the requirements
+ of this section 3.
+
+3.2 When the Program is Distributed as Source Code:
+
+ a) it must be made available under this Agreement, or if the
+ Program (i) is combined with other material in a separate file or
+ files made available under a Secondary License, and (ii) the initial
+ Contributor attached to the Source Code the notice described in
+ Exhibit A of this Agreement, then the Program may be made available
+ under the terms of such Secondary Licenses, and
+
+ b) a copy of this Agreement must be included with each copy of
+ the Program.
+
+3.3 Contributors may not remove or alter any copyright, patent,
+trademark, attribution notices, disclaimers of warranty, or limitations
+of liability ("notices") contained within the Program from any copy of
+the Program which they Distribute, provided that Contributors may add
+their own appropriate notices.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities
+with respect to end users, business partners and the like. While this
+license is intended to facilitate the commercial use of the Program,
+the Contributor who includes the Program in a commercial product
+offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes
+the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every
+other Contributor ("Indemnified Contributor") against any losses,
+damages and costs (collectively "Losses") arising from claims, lawsuits
+and other legal actions brought by a third party against the Indemnified
+Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program
+in a commercial product offering. The obligations in this section do not
+apply to any claims or Losses relating to any actual or alleged
+intellectual property infringement. In order to qualify, an Indemnified
+Contributor must: a) promptly notify the Commercial Contributor in
+writing of such claim, and b) allow the Commercial Contributor to control,
+and cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may
+participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those performance
+claims and warranties, and if a court requires any other Contributor to
+pay any damages as a result, the Commercial Contributor must pay
+those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
+BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
+TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE. Each Recipient is solely responsible for determining the
+appropriateness of using and distributing the Program and assumes all
+risks associated with its exercise of rights under this Agreement,
+including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs
+or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
+SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
+PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
+EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other software
+or hardware) infringes such Recipient's patent(s), then such Recipient's
+rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign the
+responsibility to serve as the Agreement Steward to a suitable separate
+entity. Each new version of the Agreement will be given a distinguishing
+version number. The Program (including Contributions) may always be
+Distributed subject to the version of the Agreement under which it was
+received. In addition, after a new version of the Agreement is published,
+Contributor may elect to Distribute the Program (including its
+Contributions) under the new version.
+
+Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
+receives no rights or licenses to the intellectual property of any
+Contributor under this Agreement, whether expressly, by implication,
+estoppel or otherwise. All rights in the Program not expressly granted
+under this Agreement are reserved. Nothing in this Agreement is intended
+to be enforceable by any entity that is not a Contributor or Recipient.
+No third-party beneficiary rights are created under this Agreement.
+
+Exhibit A - Form of Secondary Licenses Notice
+
+"This Source Code may also be made available under the following
+Secondary Licenses when the conditions for such availability set forth
+in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
+version(s), and exceptions or additional permissions here}."
+
+ Simply including a copy of this Agreement, including this Exhibit A
+ is not sufficient to license the Source Code under Secondary Licenses.
+
+ If it is not possible or desirable to put the notice in a particular
+ file, then You may include the notice in a location (such as a LICENSE
+ file in a relevant directory) where a recipient would be likely to
+ look for such a notice.
+
+ You may add additional accurate notices of copyright ownership.
\ No newline at end of file
diff --git a/apache-maven/src/main/appended-resources/licenses/MIT-jsoup-1.12.1.txt b/apache-maven/src/main/appended-resources/licenses/MIT-jsoup-1.12.1.txt
deleted file mode 100644
index fa8a44e09e62..000000000000
--- a/apache-maven/src/main/appended-resources/licenses/MIT-jsoup-1.12.1.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-https://raw.githubusercontent.com/jhy/jsoup/jsoup-1.12.1/LICENSE
-
-The MIT License
-
-Copyright (c) 2009-2019 Jonathan Hedley
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/apache-maven/src/main/appended-resources/licenses/MIT-slf4j-api-1.7.29.txt b/apache-maven/src/main/appended-resources/licenses/MIT-slf4j-api-1.7.29.txt
deleted file mode 100644
index 5a09409f3638..000000000000
--- a/apache-maven/src/main/appended-resources/licenses/MIT-slf4j-api-1.7.29.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-https://raw.githubusercontent.com/qos-ch/slf4j/v_1.7.29/LICENSE.txt
-
-Copyright (c) 2004-2017 QOS.ch
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/apache-maven/src/main/appended-resources/licenses/MIT.txt b/apache-maven/src/main/appended-resources/licenses/MIT.txt
new file mode 100644
index 000000000000..d69be60416d5
--- /dev/null
+++ b/apache-maven/src/main/appended-resources/licenses/MIT.txt
@@ -0,0 +1,20 @@
+ Copyright
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/apache-maven/src/main/appended-resources/licenses/Public-Domain.txt b/apache-maven/src/main/appended-resources/licenses/Public-Domain.txt
new file mode 100644
index 000000000000..a7a158b93c32
--- /dev/null
+++ b/apache-maven/src/main/appended-resources/licenses/Public-Domain.txt
@@ -0,0 +1 @@
+Public Domain
\ No newline at end of file
diff --git a/apache-maven/src/site/apt/index.apt.vm b/apache-maven/src/site/apt/index.apt.vm
new file mode 100644
index 000000000000..ae7ff8fd49ed
--- /dev/null
+++ b/apache-maven/src/site/apt/index.apt.vm
@@ -0,0 +1,43 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+ -----
+ ${project.name}
+ -----
+ Hervé Boutemy
+ -----
+ 2021-07-11
+ -----
+
+${project.name}
+
+ ${project.description}
+
+* References
+
+ * <<>> invocation can be customized through pre-invocation script calls, that can be disabled by setting <<>> environment variable:
+
+*----------+--------------------------------------------+-----------------------+
+|| || system level || user level
+*----------+--------------------------------------------+-----------------------+
+|| POSIX | <<>>\
+|| | <<>> (since 3.8.2) | <<<$HOME/.mavenrc>>>
+*----------+--------------------------------------------+-----------------------+
+|| Windows | <<<%PROGRAMDATA%\\mavenrc.cmd>>> (since 4) | <<<%USERPROFILE%\\mavenrc_pre.bat>>>\
+|| | | <<<%USERPROFILE%\\mavenrc_pre.cmd>>> (since 3.3.1)\
+|| | | <<<%USERPROFILE%\\mavenrc.cmd>>> (since 4)
+*----------+--------------------------------------------+-----------------------+
diff --git a/apache-maven/src/site/site.xml b/apache-maven/src/site/site.xml
index cd7807c147fd..c7d1796dcdec 100644
--- a/apache-maven/src/site/site.xml
+++ b/apache-maven/src/site/site.xml
@@ -19,13 +19,14 @@ specific language governing permissions and limitations
under the License.
-->
-
+${project.scm.url}
-
-
+
-
\ No newline at end of file
+
diff --git a/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java b/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java
deleted file mode 100644
index 0d0543e2899d..000000000000
--- a/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.apache.maven.settings;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import junit.framework.TestCase;
-import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-/**
- * Tests that the global settings.xml shipped with the distribution is in good state.
- *
- * @author Benjamin Bentmann
- */
-public class GlobalSettingsTest
- extends TestCase
-{
-
- public void testValidGlobalSettings()
- throws Exception
- {
- String basedir = System.getProperty( "basedir", System.getProperty( "user.dir" ) );
-
- File globalSettingsFile = new File( basedir, "src/conf/settings.xml" );
- assertTrue( globalSettingsFile.getAbsolutePath(), globalSettingsFile.isFile() );
-
- try ( Reader reader = new InputStreamReader( new FileInputStream( globalSettingsFile ), "UTF-8" ) )
- {
- new SettingsXpp3Reader().read( reader );
- }
- }
-
-}
diff --git a/api/maven-api-annotations/pom.xml b/api/maven-api-annotations/pom.xml
new file mode 100644
index 000000000000..350873e35a30
--- /dev/null
+++ b/api/maven-api-annotations/pom.xml
@@ -0,0 +1,33 @@
+
+
+
+ 4.0.0
+
+
+ org.apache.maven
+ maven-api
+ 4.1.0-SNAPSHOT
+
+
+ maven-api-annotations
+ Maven 4 API :: Meta annotations
+ Maven 4 API - Java meta annotations.
+
+
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Config.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Config.java
new file mode 100644
index 000000000000..6fe290478702
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Config.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to mark fields that represent configuration properties.
+ * This annotation provides metadata about how the configuration property
+ * should be handled, including its source, type, default value, and whether it's read-only.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.FIELD)
+public @interface Config {
+
+ /**
+ * Specifies the source of the configuration property, which determines when and where the property
+ * will be read from or set for consumption in the Maven build lifecycle.
+ *
+ * The source indicates whether the property is:
+ * - Set by Maven itself at startup (SYSTEM_PROPERTIES)
+ * - Configured by users through external means like CLI options (USER_PROPERTIES)
+ * - Defined in the project's POM file (MODEL)
+ *
+ * @return the source of the configuration property, defaults to USER_PROPERTIES
+ * @see Source for detailed information about each source type and when it's used
+ */
+ Source source() default Source.USER_PROPERTIES;
+
+ /**
+ * Specifies the type of the configuration property.
+ *
+ * @return the fully qualified class name of the property type, defaults to "java.lang.String"
+ */
+ String type() default "java.lang.String";
+
+ /**
+ * Specifies the default value of the configuration property.
+ *
+ * @return the default value as a string, defaults to empty string
+ */
+ String defaultValue() default "";
+
+ /**
+ * Specifies whether the configuration property is read-only.
+ *
+ * @return true if the property is read-only, false otherwise
+ */
+ boolean readOnly() default false;
+
+ /**
+ * Property source, which determines when and where the property will be read from or set for consumption.
+ * The source indicates the timing of property evaluation in the Maven build lifecycle and the location
+ * where the property value is defined.
+ */
+ enum Source {
+ /**
+ * Maven system properties. These properties are evaluated very early during the boot process,
+ * typically set by Maven itself and flagged as readOnly=true or by users via maven-system.properties files.
+ * System properties are initialized before the build starts and are available throughout the entire Maven
+ * execution. They are used for core Maven functionality that needs to be established at startup.
+ */
+ SYSTEM_PROPERTIES,
+ /**
+ * Maven user properties. These are properties that users configure through various means such as
+ * maven-user.properties files, maven.config files, command line parameters (-D flags), settings.xml,
+ * or environment variables. They are evaluated during the build process and represent the primary
+ * way for users to customize Maven's behavior at runtime.
+ */
+ USER_PROPERTIES,
+ /**
+ * Project model properties. These properties are defined in the project's POM file (pom.xml) and
+ * are read from the project model during the build. They represent build-time configuration that
+ * is specific to the project and is stored with the project definition itself rather than in
+ * external configuration.
+ */
+ MODEL
+ }
+}
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Consumer.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Consumer.java
new file mode 100644
index 000000000000..63e720c62e1f
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Consumer.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * A type implemented by, or extended by maven plugins or extensions.
+ * Maven plugins or extensions may provide implementations of those types which will be used by maven.
+ *
+ * A type can be marked {@link Consumer} or {@link Provider} but not both. A type is assumed to be
+ * {@link Consumer} if it is not marked either {@link Consumer} or {@link Provider}.
+ *
+ * A package can be marked {@link Consumer}. In this case, all types in the package are considered
+ * to be a provider type regardless of whether they are marked {@link Consumer} or {@link Provider}.
+ *
+ * @see Provider
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.CLASS)
+@Target({ElementType.TYPE, ElementType.PACKAGE})
+public @interface Consumer {}
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Experimental.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Experimental.java
new file mode 100644
index 000000000000..6554cea29421
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Experimental.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * This annotation tags types that are part of an experimental API.
+ * Classes or methods annotated with this annotation may be changed / removed without notice.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.CLASS)
+public @interface Experimental {}
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Generated.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Generated.java
new file mode 100644
index 000000000000..d41ba1cbc00b
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Generated.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation indicates that a type is automatically generated.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface Generated {}
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Immutable.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Immutable.java
new file mode 100644
index 000000000000..e86d17fbedc3
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Immutable.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The {@code Immutable} annotation indicates that the object is immutable, i.e.
+ * none of its field can be changed. This also ensures that the type is
+ * {@link ThreadSafe}.
+ *
+ * @see ThreadSafe
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.CLASS)
+@ThreadSafe
+@Target(ElementType.TYPE)
+public @interface Immutable {}
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Nonnull.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Nonnull.java
new file mode 100644
index 000000000000..ada5c0dceff4
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Nonnull.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The annotated element must not be null.
+ *
+ * Annotated fields must not be null after construction has completed.
+ *
+ * When this annotation is applied to a method it applies to the method return value.
+ *
+ * @see Nullable
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.CLASS)
+@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
+public @interface Nonnull {}
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/NotThreadSafe.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/NotThreadSafe.java
new file mode 100644
index 000000000000..348ca77a35b8
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/NotThreadSafe.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation indicates that the annotated type is not threadsafe
+ * and should only be used by a single thread.
+ *
+ * @see ThreadSafe
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface NotThreadSafe {}
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Nullable.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Nullable.java
new file mode 100644
index 000000000000..df2517cad9aa
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Nullable.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * The annotated element can be {@code null}.
+ *
+ * @see Nonnull
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Nullable {}
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Provider.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Provider.java
new file mode 100644
index 000000000000..69d73db7c8f2
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/Provider.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * A type implemented by, or extended by maven itself.
+ * Maven provides implementations of those types and may inject them in plugins.
+ *
+ * A type can be marked {@link Consumer} or {@link Provider} but not both. A type is assumed to be
+ * {@link Consumer} if it is not marked either {@link Consumer} or {@link Provider}.
+ *
+ * A package can be marked {@link Provider}. In this case, all types in the package are considered
+ * to be a provider type regardless of whether they are marked {@link Consumer} or {@link Provider}.
+ *
+ * @see Consumer
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.CLASS)
+@Target({ElementType.TYPE, ElementType.PACKAGE})
+public @interface Provider {}
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/ThreadSafe.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/ThreadSafe.java
new file mode 100644
index 000000000000..9b500c2f4340
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/ThreadSafe.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The {@code ThreadSafe} annotation can be used to indicate a given type
+ * is thread safe. {@link Immutable} objects are automatically thread safe.
+ *
+ * @see Immutable
+ * @see NotThreadSafe
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface ThreadSafe {}
diff --git a/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/package-info.java b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/package-info.java
new file mode 100644
index 000000000000..220a5c381453
--- /dev/null
+++ b/api/maven-api-annotations/src/main/java/org/apache/maven/api/annotations/package-info.java
@@ -0,0 +1,10 @@
+// CHECKSTYLE_OFF: RegexpHeader
+/**
+ * This package contains non-functional annotations which are
+ * used to tag various elements and help users understanding
+ * how those types should be used.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+package org.apache.maven.api.annotations;
diff --git a/api/maven-api-annotations/src/site/site.xml b/api/maven-api-annotations/src/site/site.xml
new file mode 100644
index 000000000000..6a599fce2b80
--- /dev/null
+++ b/api/maven-api-annotations/src/site/site.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+ ${project.scm.url}
+
+
+
+
+
+
+
+
diff --git a/api/maven-api-cli/pom.xml b/api/maven-api-cli/pom.xml
new file mode 100644
index 000000000000..6ed5c71eff71
--- /dev/null
+++ b/api/maven-api-cli/pom.xml
@@ -0,0 +1,83 @@
+
+
+
+ 4.0.0
+
+
+ org.apache.maven
+ maven-api
+ 4.1.0-SNAPSHOT
+
+
+ maven-api-cli
+ Maven 4 API :: CLI
+ Maven 4 API - CLI.
+
+
+
+ org.apache.maven
+ maven-api-annotations
+
+
+ org.apache.maven
+ maven-api-core
+
+
+ org.apache.maven
+ maven-api-xml
+
+
+
+
+
+
+ org.codehaus.modello
+ modello-maven-plugin
+
+ 1.2.0
+
+ src/main/mdo/core-extensions.mdo
+
+
+ model.vm
+
+
+ locationTracking=true
+ generateLocationClasses=true
+ packageModelV4=org.apache.maven.api.cli.extensions
+ packageToolV4=org.apache.maven.cli.internal.extension.io
+
+ ${project.basedir}/../../src/mdo
+
+
+
+ modello
+
+ velocity
+ xdoc
+ xsd
+
+ generate-sources
+
+
+
+
+
+
diff --git a/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/CoreExtensions.java b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/CoreExtensions.java
new file mode 100644
index 000000000000..8206b26b0a95
--- /dev/null
+++ b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/CoreExtensions.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cli;
+
+import java.nio.file.Path;
+import java.util.List;
+
+import org.apache.maven.api.Constants;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.cli.extensions.CoreExtension;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * Represents the list of core extensions configured at one source. The list is validated (are GA unique), but no
+ * other logic than that is applied.
+ *
+ * @since 4.0.0
+ * @param source The source file of core extensions, is never {@code null}.
+ * @param coreExtensions The configured core extensions, is never {@code null}. Contents of list is guaranteed to be unique by GA.
+ *
+ * @see Constants#MAVEN_PROJECT_EXTENSIONS
+ * @see Constants#MAVEN_USER_EXTENSIONS
+ * @see Constants#MAVEN_INSTALLATION_EXTENSIONS
+ */
+@Experimental
+public record CoreExtensions(Path source, List coreExtensions) {
+ public CoreExtensions(Path source, List coreExtensions) {
+ this.source = requireNonNull(source, "source");
+ this.coreExtensions = requireNonNull(coreExtensions, "coreExtensions");
+ }
+}
diff --git a/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Invoker.java b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Invoker.java
new file mode 100644
index 000000000000..3c4cb05ecaab
--- /dev/null
+++ b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Invoker.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cli;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Defines the contract for a component responsible for invoking a Maven application
+ * using the information provided in an {@link InvokerRequest}. This interface is central
+ * to the construction and invocation of Maven commands and builds, and it fully parses arguments.
+ *
+ *
The Invoker is designed to be flexible, allowing for different implementations
+ * that can handle various types of {@link InvokerRequest InvokerRequests}. It also implements
+ * {@link AutoCloseable} to ensure proper resource management.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface Invoker extends AutoCloseable {
+ /**
+ * Invokes the Maven application using the provided {@link InvokerRequest}.
+ * This method is responsible for executing the Maven command or build
+ * process based on the information contained in the request.
+ *
+ * @param invokerRequest the request containing all necessary information for the invocation
+ * @return an integer representing the exit code of the invocation (0 typically indicates success)
+ * @throws InvokerException if an error occurs during the invocation process.
+ */
+ int invoke(@Nonnull InvokerRequest invokerRequest) throws InvokerException;
+
+ /**
+ * Closes and disposes of this {@link Invoker} instance, releasing any resources it may hold.
+ * This method is called automatically when using try-with-resources statements.
+ *
+ *
The default implementation does nothing. Subclasses should override this method
+ * if they need to perform cleanup operations.
+ *
+ * @throws InvokerException if an error occurs while closing the {@link Invoker}
+ */
+ @Override
+ default void close() throws InvokerException {}
+}
diff --git a/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/InvokerException.java b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/InvokerException.java
new file mode 100644
index 000000000000..d1a479b71127
--- /dev/null
+++ b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/InvokerException.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cli;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nullable;
+import org.apache.maven.api.services.MavenException;
+
+/**
+ * Represents an exception that occurs during the invocation of a Maven build or command.
+ * This exception is typically thrown when there are errors during the execution of a Maven
+ * process, such as build failures, plugin errors, or other runtime issues.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public class InvokerException extends MavenException {
+ /**
+ * Constructs a new {@code InvokerException} with the specified detail message.
+ *
+ * @param message the detail message explaining the cause of the exception
+ */
+ public InvokerException(@Nullable String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new {@code InvokerException} with the specified detail message and cause.
+ *
+ * @param message the detail message explaining the cause of the exception
+ * @param cause the underlying cause of the exception
+ */
+ public InvokerException(@Nullable String message, @Nullable Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Exception for intentional exit: No message or anything will be displayed, just the
+ * carried exit code will be returned from invoker {@link Invoker#invoke(InvokerRequest)} method.
+ */
+ public static final class ExitException extends InvokerException {
+ private final int exitCode;
+
+ public ExitException(int exitCode) {
+ super("EXIT");
+ this.exitCode = exitCode;
+ }
+
+ public int getExitCode() {
+ return exitCode;
+ }
+ }
+}
diff --git a/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/InvokerRequest.java b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/InvokerRequest.java
new file mode 100644
index 000000000000..e63a515bb9ff
--- /dev/null
+++ b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/InvokerRequest.java
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cli;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.cli.cisupport.CIInfo;
+import org.apache.maven.api.services.Lookup;
+import org.apache.maven.api.services.MessageBuilderFactory;
+
+/**
+ * Represents a Maven invocation request, encapsulating all necessary information
+ * for invoking a Maven build or command. Arguments are parsed and exposed via methods.
+ *
+ * @since 4.0.0
+ */
+@Immutable
+@Experimental
+public interface InvokerRequest {
+ /**
+ * The parser request this instance was created from.
+ */
+ @Nonnull
+ ParserRequest parserRequest();
+
+ /**
+ * Flag representing parser processing result: if there were some fatal errors during
+ * {@link Parser#parseInvocation(ParserRequest)} this method will return {@code true} and invoker should
+ * handle this request as "early failure". In these cases, {@link #options()} usually is absent.
+ */
+ boolean parsingFailed();
+
+ /**
+ * Returns {@code true} if this call happens in "embedded" mode.
+ *
+ * @see ParserRequest#embedded()
+ */
+ default boolean embedded() {
+ return parserRequest().embedded();
+ }
+
+ /**
+ * Returns the current working directory for the Maven execution.
+ * This is typically the directory from which Maven was invoked.
+ *
+ * @return the current working directory path
+ */
+ @Nonnull
+ Path cwd();
+
+ /**
+ * Returns the Maven installation directory.
+ * This is usually set by the Maven launcher script using the "maven.home" system property.
+ *
+ * @return the Maven installation directory path
+ */
+ @Nonnull
+ Path installationDirectory();
+
+ /**
+ * Returns the user's home directory.
+ * This is typically obtained from the "user.home" system property.
+ *
+ * @return the user's home directory path
+ */
+ @Nonnull
+ Path userHomeDirectory();
+
+ /**
+ * Shorthand for {@link MessageBuilderFactory}.
+ */
+ default MessageBuilderFactory messageBuilderFactory() {
+ return parserRequest().messageBuilderFactory();
+ }
+
+ /**
+ * Shorthand for {@link Lookup}.
+ */
+ default Lookup lookup() {
+ return parserRequest().lookup();
+ }
+
+ /**
+ * Returns a map of user-defined properties for the Maven execution.
+ * These properties can be set using the -D command-line option.
+ *
+ * @return an unmodifiable map of user properties
+ */
+ @Nonnull
+ Map userProperties();
+
+ /**
+ * Returns a map of system properties for the Maven execution.
+ * These include both Java system properties and Maven-specific system properties.
+ *
+ * @return an unmodifiable map of system properties
+ */
+ @Nonnull
+ Map systemProperties();
+
+ /**
+ * Returns the top-level directory of the Maven invocation.
+ * This is typically the directory containing the POM file being executed.
+ *
+ * @return the top-level directory path
+ */
+ @Nonnull
+ Path topDirectory();
+
+ /**
+ * Returns the root directory of the Maven invocation, if found. This is determined by the presence of a
+ * {@code .mvn} directory or a POM with the root="true" property but is not always applicable (ie invocation
+ * from outside a checkout).
+ *
+ * @return the root directory path, if present
+ */
+ @Nonnull
+ Optional rootDirectory();
+
+ /**
+ * Returns the input stream for the Maven execution, if running in embedded mode.
+ *
+ * @return an {@link Optional} containing the input stream, or empty if not applicable
+ */
+ @Nonnull
+ default Optional stdIn() {
+ return Optional.ofNullable(parserRequest().stdIn());
+ }
+
+ /**
+ * Returns the output stream for the Maven execution, if running in embedded mode.
+ *
+ * @return an {@link Optional} containing the output stream, or empty if not applicable
+ */
+ @Nonnull
+ default Optional stdOut() {
+ return Optional.ofNullable(parserRequest().stdOut());
+ }
+
+ /**
+ * Returns the error stream for the Maven execution, if running in embedded mode.
+ *
+ * @return an {@link Optional} containing the error stream, or empty if not applicable
+ */
+ @Nonnull
+ default Optional stdErr() {
+ return Optional.ofNullable(parserRequest().stdErr());
+ }
+
+ /**
+ * Returns a list of core extensions from all sources, that were discovered and loaded. Each instance of
+ * {@link CoreExtensions} is validated, but the list elements may have overlapping elements, that requires
+ * some logic to sort out (like precedence).
+ *
+ * The list of {@link CoreExtensions} if present, is in precedence order.
+ *
+ * @return an {@link Optional} containing the {@link CoreExtensions}, or empty if not configured
+ */
+ @Nonnull
+ Optional> coreExtensions();
+
+ /**
+ * Returns detected CI system, if any.
+ *
+ * @return an {@link Optional} containing the {@link CIInfo} collected from CI system. or empty if CI not
+ * detected.
+ */
+ @Nonnull
+ Optional ciInfo();
+
+ /**
+ * Returns the options associated with this invocation request.
+ *
+ * @return the options optional. It will be absent if {@link #parsingFailed()} return {@code true}.
+ */
+ @Nonnull
+ Optional options();
+
+ /**
+ * This method returns "verbose" option value derived from multiple places: CLI options, but also CI detection,
+ * if applicable.
+ */
+ default boolean effectiveVerbose() {
+ return options().isPresent() && options().orElseThrow().verbose().orElse(false)
+ || ciInfo().isPresent() && ciInfo().orElseThrow().isVerbose();
+ }
+}
diff --git a/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Logger.java b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Logger.java
new file mode 100644
index 000000000000..cd9aaff994e0
--- /dev/null
+++ b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Logger.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cli;
+
+import java.util.List;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+
+/**
+ * Defines a simple logging interface for Maven CLI operations. These operations happen "early", when there may
+ * be no logging set up even. Implementations may be "accumulating", in which case {@link #drain()} method should
+ * be used.
+ *
+ * This interface provides methods for logging messages at different severity levels
+ * and supports logging with or without associated exceptions.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface Logger {
+
+ /**
+ * Represents the severity levels for log messages.
+ */
+ enum Level {
+ DEBUG,
+ INFO,
+ WARN,
+ ERROR
+ }
+
+ /**
+ * Logs a message at the specified level without an associated exception.
+ *
+ * @param level the severity level of the message
+ * @param message the message to be logged
+ */
+ default void log(@Nonnull Level level, @Nonnull String message) {
+ log(level, message, null);
+ }
+
+ /**
+ * Logs a message at the specified level with an associated exception.
+ *
+ * @param level the severity level of the message
+ * @param message the message to be logged
+ * @param error the associated exception, or null if not applicable
+ */
+ void log(@Nonnull Level level, @Nonnull String message, @Nullable Throwable error);
+
+ /**
+ * Logs a debug message without an associated exception.
+ *
+ * @param message the debug message to be logged
+ */
+ default void debug(String message) {
+ log(Level.DEBUG, message);
+ }
+
+ /**
+ * Logs a debug message with an associated exception.
+ *
+ * @param message the debug message to be logged
+ * @param error the associated exception
+ */
+ default void debug(@Nonnull String message, @Nullable Throwable error) {
+ log(Level.DEBUG, message, error);
+ }
+
+ /**
+ * Logs an info message without an associated exception.
+ *
+ * @param message the info message to be logged
+ */
+ default void info(@Nonnull String message) {
+ log(Level.INFO, message);
+ }
+
+ /**
+ * Logs an info message with an associated exception.
+ *
+ * @param message the info message to be logged
+ * @param error the associated exception
+ */
+ default void info(@Nonnull String message, @Nullable Throwable error) {
+ log(Level.INFO, message, error);
+ }
+
+ /**
+ * Logs a warning message without an associated exception.
+ *
+ * @param message the warning message to be logged
+ */
+ default void warn(@Nonnull String message) {
+ log(Level.WARN, message);
+ }
+
+ /**
+ * Logs a warning message with an associated exception.
+ *
+ * @param message the warning message to be logged
+ * @param error the associated exception
+ */
+ default void warn(@Nonnull String message, @Nullable Throwable error) {
+ log(Level.WARN, message, error);
+ }
+
+ /**
+ * Logs an error message without an associated exception.
+ *
+ * @param message the error message to be logged
+ */
+ default void error(@Nonnull String message) {
+ log(Level.ERROR, message);
+ }
+
+ /**
+ * Logs an error message with an associated exception.
+ *
+ * @param message the error message to be logged
+ * @param error the associated exception
+ */
+ default void error(@Nonnull String message, @Nullable Throwable error) {
+ log(Level.ERROR, message, error);
+ }
+
+ /**
+ * Logger entries returned by {@link #drain()} method.
+ * @param level The logging level, never {@code null}.
+ * @param message The logging message, never {@code null}.
+ * @param error The error, if applicable.
+ */
+ record Entry(@Nonnull Level level, @Nonnull String message, @Nullable Throwable error) {}
+
+ /**
+ * If this is an accumulating log, it will "drain" this instance. It returns the accumulated log entries, and
+ * also "resets" this instance to empty (initial) state.
+ */
+ @Nonnull
+ default List drain() {
+ return List.of();
+ }
+}
diff --git a/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Options.java b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Options.java
new file mode 100644
index 000000000000..d2bf596cd916
--- /dev/null
+++ b/api/maven-api-cli/src/main/java/org/apache/maven/api/cli/Options.java
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cli;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Consumer;
+import java.util.function.UnaryOperator;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Represents the base options supported by Maven tools.
+ * This interface defines methods to access various configuration options
+ * that can be set through command-line arguments or configuration files.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface Options {
+ /** Constant indicating that the options source is the command-line interface. */
+ String SOURCE_CLI = "CLI";
+
+ /**
+ * Returns a simple designator of the options source, such as "cli", "maven.conf", etc.
+ *
+ * @return a string representing the source of the options
+ */
+ @Nonnull
+ String source();
+
+ /**
+ * Returns the user-defined properties for the Maven execution.
+ *
+ * @return an {@link Optional} containing the map of user properties, or empty if not set
+ */
+ @Nonnull
+ Optional
+
The default location for the Core Extensions descriptor file is ${maven.projectBasedir}/.mvn/extensions.xml
+ ]]>
+
+
+
+ package
+ org.apache.maven.cli.internal.extension.model
+
+
+
+
+
+ CoreExtensions
+ Extensions to load.
+ 1.0.0+
+
+
+ extensions
+ A set of build extensions to use from this project.
+ 1.0.0+
+
+ CoreExtension
+ *
+
+
+
+
+
+ CoreExtension
+ Describes a build extension to utilise.
+ 1.0.0+
+
+
+ groupId
+ The group ID of the extension's artifact.
+ 1.0.0+
+ true
+ String
+
+
+ artifactId
+ The artifact ID of the extension.
+ 1.0.0+
+ true
+ String
+
+
+ version
+ The version of the extension.
+ 1.0.0+
+ true
+ String
+
+
+ classLoadingStrategy
+ The class loading strategy: 'self-first' (the default), 'parent-first' (loads classes from the parent, then from the extension) or 'plugin' (follows the rules from extensions defined as plugins).
+ 1.1.0+
+ self-first
+ false
+ String
+
+
+ configuration
+ 1.2.0+
+ false
+ DOM
+
+
+
+
+ 1.0.0+
+
+ ::}, never {@code null}.
+ */
+ public String getId() {
+ return (getGroupId() == null ? "[unknown-group-id]" : getGroupId())
+ + ":" + (getArtifactId() == null ? "[unknown-artifact-id]" : getArtifactId())
+ + ":" + (getVersion() == null ? "[unknown-version]" : getVersion());
+ }
+ ]]>
+
+
+
+
+
+
diff --git a/api/maven-api-core/pom.xml b/api/maven-api-core/pom.xml
new file mode 100644
index 000000000000..339ea8319217
--- /dev/null
+++ b/api/maven-api-core/pom.xml
@@ -0,0 +1,75 @@
+
+
+
+ 4.0.0
+
+
+ org.apache.maven
+ maven-api
+ 4.1.0-SNAPSHOT
+
+
+ maven-api-core
+ Maven 4 API :: Core
+ Maven 4 API - Maven Core API
+
+
+
+ org.apache.maven
+ maven-api-annotations
+
+
+ org.apache.maven
+ maven-api-di
+
+
+ org.apache.maven
+ maven-api-model
+
+
+ org.apache.maven
+ maven-api-settings
+
+
+ org.apache.maven
+ maven-api-toolchain
+
+
+ org.apache.maven
+ maven-api-plugin
+
+
+ org.apache.maven
+ maven-api-xml
+
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.mockito
+ mockito-core
+ test
+
+
+
+
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java
new file mode 100644
index 000000000000..d26972c0060b
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * A Maven artifact is a file, typically a JAR, that is produced and used by Maven projects.
+ * It is identified by a unique combination of a group ID, artifact ID, version, classifier,
+ * and extension, and it is stored in a repository for dependency management and build purposes.
+ *
+ *
Each {@code Artifact} instance is basically an exact pointer to a file in a Maven repository.
+ * {@code Artifact} instances are created when resolving {@link ArtifactCoordinates} instances.
+ * Resolving is the process that selects a {@linkplain #getVersion() particular version}
+ * and downloads the artifact in the local repository. This operation returns a {@link DownloadedArtifact}.
+ *
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface Artifact {
+ /**
+ * {@return a unique identifier for this artifact}.
+ * The identifier is composed of groupId, artifactId, extension, classifier, and version.
+ *
+ * @see ArtifactCoordinates#getId()
+ */
+ @Nonnull
+ default String key() {
+ String c = getClassifier();
+ return getGroupId()
+ + ':'
+ + getArtifactId()
+ + ':'
+ + getExtension()
+ + (c.isEmpty() ? "" : ":" + c)
+ + ':'
+ + getVersion();
+ }
+
+ /**
+ * {@return the group identifier of the artifact}.
+ *
+ * @see ArtifactCoordinates#getGroupId()
+ */
+ @Nonnull
+ String getGroupId();
+
+ /**
+ * {@return the identifier of the artifact}.
+ *
+ * @see ArtifactCoordinates#getArtifactId()
+ */
+ @Nonnull
+ String getArtifactId();
+
+ /**
+ * {@return the version of the artifact}.
+ * Contrarily to {@link ArtifactCoordinates},
+ * each {@code Artifact} is associated to a specific version instead of a range of versions.
+ * If the {@linkplain #getBaseVersion() base version} contains a meta-version such as {@code SNAPSHOT},
+ * those keywords are replaced by, for example, the actual timestamp.
+ *
+ * @see ArtifactCoordinates#getVersionConstraint()
+ */
+ @Nonnull
+ Version getVersion();
+
+ /**
+ * {@return the version or meta-version of the artifact}.
+ * A meta-version is a version suffixed with the {@code SNAPSHOT} keyword.
+ * Meta-versions are represented in a base version by their symbols (e.g., {@code SNAPSHOT}),
+ * while they are replaced by, for example, the actual timestamp in the {@linkplain #getVersion() version}.
+ */
+ @Nonnull
+ Version getBaseVersion();
+
+ /**
+ * Returns the classifier of the artifact.
+ *
+ * @return the classifier or an empty string if none, never {@code null}
+ * @see ArtifactCoordinates#getClassifier()
+ */
+ @Nonnull
+ String getClassifier();
+
+ /**
+ * Returns the file extension of the artifact.
+ * The dot separator is not included in the returned string.
+ *
+ * @return the file extension or an empty string if none, never {@code null}
+ * @see ArtifactCoordinates#getExtension()
+ */
+ @Nonnull
+ String getExtension();
+
+ /**
+ * Determines whether this artifact uses a snapshot version.
+ *
+ * @return {@code true} if the artifact is a snapshot, {@code false} otherwise
+ * @see org.apache.maven.api.Session#isVersionSnapshot(String)
+ */
+ boolean isSnapshot();
+
+ /**
+ * {@return coordinates with the same identifiers as this artifact}.
+ * This is a shortcut for {@code session.createArtifactCoordinates(artifact)}.
+ *
+ * @see org.apache.maven.api.Session#createArtifactCoordinates(Artifact)
+ */
+ @Nonnull
+ ArtifactCoordinates toCoordinates();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinates.java b/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinates.java
new file mode 100644
index 000000000000..89a7e37aa581
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinates.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Partial identification of an {@link Artifact} in a Maven repository.
+ * Each {@code ArtifactCoordinates} instance is basically a pointer to a file in the Maven repository,
+ * except that the exact version may not be known yet.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactCoordinates {
+ /**
+ * {@return the group identifier of the artifact}.
+ */
+ @Nonnull
+ String getGroupId();
+
+ /**
+ * {@return the identifier of the artifact}.
+ */
+ @Nonnull
+ String getArtifactId();
+
+ /**
+ * Returns the classifier of the artifact.
+ *
+ * @return the classifier or an empty string if none, never {@code null}
+ */
+ @Nonnull
+ String getClassifier();
+
+ /**
+ * {@return the specific version, range of versions, or meta-version of the artifact}.
+ * A meta-version is a version suffixed with the {@code SNAPSHOT} keyword.
+ */
+ @Nonnull
+ VersionConstraint getVersionConstraint();
+
+ /**
+ * Returns the file extension of the artifact.
+ * The dot separator is not included in the returned string.
+ *
+ * @return the file extension or an empty string if none, never {@code null}
+ */
+ @Nonnull
+ String getExtension();
+
+ /**
+ * {@return a unique string identifying this artifact}.
+ *
+ * The default implementation returns a colon-separated list of group
+ * identifier, artifact identifier, extension, classifier and version.
+ *
+ * @see Artifact#key()
+ */
+ @Nonnull
+ default String getId() {
+ String c = getClassifier();
+ return getGroupId()
+ + ':'
+ + getArtifactId()
+ + ':'
+ + getExtension()
+ + ':'
+ + c
+ + (c.isEmpty() ? "" : ":")
+ + getVersionConstraint();
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java
new file mode 100644
index 000000000000..e9cba7a434a0
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java
@@ -0,0 +1,666 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Config;
+
+/**
+ * Configuration constants.
+ */
+public final class Constants {
+
+ /**
+ * Maven home.
+ *
+ * @since 3.0.0
+ */
+ @Config(readOnly = true, source = Config.Source.SYSTEM_PROPERTIES)
+ public static final String MAVEN_HOME = "maven.home";
+
+ /**
+ * Maven version.
+ *
+ * @since 3.0.0
+ */
+ @Config(readOnly = true, source = Config.Source.SYSTEM_PROPERTIES)
+ public static final String MAVEN_VERSION = "maven.version";
+
+ /**
+ * Maven major version: contains the major segment of this Maven version.
+ *
+ * @since 4.0.0
+ */
+ @Config(readOnly = true, source = Config.Source.SYSTEM_PROPERTIES)
+ public static final String MAVEN_VERSION_MAJOR = "maven.version.major";
+
+ /**
+ * Maven minor version: contains the minor segment of this Maven version.
+ *
+ * @since 4.0.0
+ */
+ @Config(readOnly = true, source = Config.Source.SYSTEM_PROPERTIES)
+ public static final String MAVEN_VERSION_MINOR = "maven.version.minor";
+
+ /**
+ * Maven patch version: contains the patch segment of this Maven version.
+ *
+ * @since 4.0.0
+ */
+ @Config(readOnly = true, source = Config.Source.SYSTEM_PROPERTIES)
+ public static final String MAVEN_VERSION_PATCH = "maven.version.patch";
+
+ /**
+ * Maven snapshot: contains "true" if this Maven is a snapshot version.
+ *
+ * @since 4.0.0
+ */
+ @Config(readOnly = true, source = Config.Source.SYSTEM_PROPERTIES)
+ public static final String MAVEN_VERSION_SNAPSHOT = "maven.version.snapshot";
+
+ /**
+ * Maven build version: a human-readable string containing this Maven version, buildnumber, and time of its build.
+ *
+ * @since 3.0.0
+ */
+ @Config(readOnly = true, source = Config.Source.SYSTEM_PROPERTIES)
+ public static final String MAVEN_BUILD_VERSION = "maven.build.version";
+
+ /**
+ * Maven installation configuration directory.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${maven.home}/conf")
+ public static final String MAVEN_INSTALLATION_CONF = "maven.installation.conf";
+
+ /**
+ * Maven user configuration directory.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${user.home}/.m2")
+ public static final String MAVEN_USER_CONF = "maven.user.conf";
+
+ /**
+ * Maven project configuration directory.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${session.rootDirectory}/.mvn")
+ public static final String MAVEN_PROJECT_CONF = "maven.project.conf";
+
+ /**
+ * Maven local repository.
+ *
+ * @since 3.0.0
+ */
+ @Config(defaultValue = "${maven.user.conf}/repository")
+ public static final String MAVEN_REPO_LOCAL = "maven.repo.local";
+
+ /**
+ * Maven central repository URL.
+ * The property will have the value of the MAVEN_REPO_CENTRAL
+ * environment variable if it is defined.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "https://repo.maven.apache.org/maven2")
+ public static final String MAVEN_REPO_CENTRAL = "maven.repo.central";
+
+ /**
+ * Maven installation settings.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${maven.installation.conf}/settings.xml")
+ public static final String MAVEN_INSTALLATION_SETTINGS = "maven.installation.settings";
+
+ /**
+ * Maven user settings.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${maven.user.conf}/settings.xml")
+ public static final String MAVEN_USER_SETTINGS = "maven.user.settings";
+
+ /**
+ * Maven project settings.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${maven.project.conf}/settings.xml")
+ public static final String MAVEN_PROJECT_SETTINGS = "maven.project.settings";
+
+ /**
+ * Maven installation extensions.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${maven.installation.conf}/extensions.xml")
+ public static final String MAVEN_INSTALLATION_EXTENSIONS = "maven.installation.extensions";
+
+ /**
+ * Maven user extensions.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${maven.user.conf}/extensions.xml")
+ public static final String MAVEN_USER_EXTENSIONS = "maven.user.extensions";
+
+ /**
+ * Maven project extensions.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${maven.project.conf}/extensions.xml")
+ public static final String MAVEN_PROJECT_EXTENSIONS = "maven.project.extensions";
+
+ /**
+ * Maven installation toolchains.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${maven.installation.conf}/toolchains.xml")
+ public static final String MAVEN_INSTALLATION_TOOLCHAINS = "maven.installation.toolchains";
+
+ /**
+ * Maven user toolchains.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "${maven.user.conf}/toolchains.xml")
+ public static final String MAVEN_USER_TOOLCHAINS = "maven.user.toolchains";
+
+ /**
+ * Extensions class path.
+ */
+ @Config
+ public static final String MAVEN_EXT_CLASS_PATH = "maven.ext.class.path";
+
+ @Config(defaultValue = "${maven.user.conf}/settings-security4.xml")
+ public static final String MAVEN_SETTINGS_SECURITY = "maven.settings.security";
+
+ public static final String MAVEN_SETTINGS_SECURITY_FILE_NAME = "settings-security4.xml";
+
+ public static final String MAVEN_STYLE_PREFIX = "maven.style.";
+
+ // Style Names
+ public static final String MAVEN_STYLE_TRANSFER_NAME = "transfer";
+ public static final String MAVEN_STYLE_TRACE_NAME = "trace";
+ public static final String MAVEN_STYLE_DEBUG_NAME = "debug";
+ public static final String MAVEN_STYLE_INFO_NAME = "info";
+ public static final String MAVEN_STYLE_WARNING_NAME = "warning";
+ public static final String MAVEN_STYLE_ERROR_NAME = "error";
+ public static final String MAVEN_STYLE_SUCCESS_NAME = "success";
+ public static final String MAVEN_STYLE_FAILURE_NAME = "failure";
+ public static final String MAVEN_STYLE_STRONG_NAME = "strong";
+ public static final String MAVEN_STYLE_MOJO_NAME = "mojo";
+ public static final String MAVEN_STYLE_PROJECT_NAME = "project";
+
+ // Default Values
+ public static final String MAVEN_STYLE_TRANSFER_DEFAULT = "f:bright-black";
+ public static final String MAVEN_STYLE_TRACE_DEFAULT = "bold,f:magenta";
+ public static final String MAVEN_STYLE_DEBUG_DEFAULT = "bold,f:cyan";
+ public static final String MAVEN_STYLE_INFO_DEFAULT = "bold,f:blue";
+ public static final String MAVEN_STYLE_WARNING_DEFAULT = "bold,f:yellow";
+ public static final String MAVEN_STYLE_ERROR_DEFAULT = "bold,f:red";
+ public static final String MAVEN_STYLE_SUCCESS_DEFAULT = "bold,f:green";
+ public static final String MAVEN_STYLE_FAILURE_DEFAULT = "bold,f:red";
+ public static final String MAVEN_STYLE_STRONG_DEFAULT = "bold";
+ public static final String MAVEN_STYLE_MOJO_DEFAULT = "f:green";
+ public static final String MAVEN_STYLE_PROJECT_DEFAULT = "f:cyan";
+
+ /**
+ * Maven output color mode.
+ * Allowed values are auto, always, never.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "auto")
+ public static final String MAVEN_STYLE_COLOR_PROPERTY = MAVEN_STYLE_PREFIX + "color";
+
+ /**
+ * Color style for transfer messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_TRANSFER_DEFAULT)
+ public static final String MAVEN_STYLE_TRANSFER = MAVEN_STYLE_PREFIX + MAVEN_STYLE_TRANSFER_NAME;
+
+ /**
+ * Color style for trace messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_TRACE_DEFAULT)
+ public static final String MAVEN_STYLE_TRACE = MAVEN_STYLE_PREFIX + MAVEN_STYLE_TRACE_NAME;
+
+ /**
+ * Color style for debug messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_DEBUG_DEFAULT)
+ public static final String MAVEN_STYLE_DEBUG = MAVEN_STYLE_PREFIX + MAVEN_STYLE_DEBUG_NAME;
+
+ /**
+ * Color style for info messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_INFO_DEFAULT)
+ public static final String MAVEN_STYLE_INFO = MAVEN_STYLE_PREFIX + MAVEN_STYLE_INFO_NAME;
+
+ /**
+ * Color style for warning messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_WARNING_DEFAULT)
+ public static final String MAVEN_STYLE_WARNING = MAVEN_STYLE_PREFIX + MAVEN_STYLE_WARNING_NAME;
+
+ /**
+ * Color style for error messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_ERROR_DEFAULT)
+ public static final String MAVEN_STYLE_ERROR = MAVEN_STYLE_PREFIX + MAVEN_STYLE_ERROR_NAME;
+
+ /**
+ * Color style for success messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_SUCCESS_DEFAULT)
+ public static final String MAVEN_STYLE_SUCCESS = MAVEN_STYLE_PREFIX + MAVEN_STYLE_SUCCESS_NAME;
+
+ /**
+ * Color style for failure messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_FAILURE_DEFAULT)
+ public static final String MAVEN_STYLE_FAILURE = MAVEN_STYLE_PREFIX + MAVEN_STYLE_FAILURE_NAME;
+
+ /**
+ * Color style for strong messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_STRONG_DEFAULT)
+ public static final String MAVEN_STYLE_STRONG = MAVEN_STYLE_PREFIX + MAVEN_STYLE_STRONG_NAME;
+
+ /**
+ * Color style for mojo messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_MOJO_DEFAULT)
+ public static final String MAVEN_STYLE_MOJO = MAVEN_STYLE_PREFIX + MAVEN_STYLE_MOJO_NAME;
+
+ /**
+ * Color style for project messages.
+ * @since 4.0.0
+ */
+ @Config(defaultValue = MAVEN_STYLE_PROJECT_DEFAULT)
+ public static final String MAVEN_STYLE_PROJECT = MAVEN_STYLE_PREFIX + MAVEN_STYLE_PROJECT_NAME;
+
+ /**
+ * Build timestamp format.
+ *
+ * @since 3.0.0
+ */
+ @Config(source = Config.Source.MODEL, defaultValue = "yyyy-MM-dd'T'HH:mm:ssXXX")
+ public static final String MAVEN_BUILD_TIMESTAMP_FORMAT = "maven.build.timestamp.format";
+
+ /**
+ * User controlled relocations.
+ * This property is a comma separated list of entries with the syntax GAV>GAV.
+ * The first GAV can contain * for any elem (so *:*:* would mean ALL, something
+ * you don't want). The second GAV is either fully specified, or also can contain *,
+ * then it behaves as "ordinary relocation": the coordinate is preserved from relocated artifact.
+ * Finally, if right hand GAV is absent (line looks like GAV>), the left hand matching
+ * GAV is banned fully (from resolving).
+ *
+ * Note: the > means project level, while >> means global (whole session level,
+ * so even plugins will get relocated artifacts) relocation.
+ *
+ * For example,
+ *
+ * means: 3 entries, ban org.foo group (exactly, so org.foo.bar is allowed),
+ * relocate org.here to org.there and finally globally relocate (see >> above)
+ * javax.inject:javax.inject:1 to jakarta.inject:jakarta.inject:1.0.5.
+ *
+ * @since 4.0.0
+ */
+ @Config
+ public static final String MAVEN_RELOCATIONS_ENTRIES = "maven.relocations.entries";
+
+ /**
+ * User property for version filter expression used in session, applied to resolving ranges: a semicolon separated
+ * list of filters to apply. By default, no version filter is applied (like in Maven 3).
+ *
+ * Supported filters:
+ *
+ *
"h" or "h(num)" - highest version or top list of highest ones filter
+ *
"l" or "l(num)" - lowest version or bottom list of lowest ones filter
+ *
"s" - contextual snapshot filter
+ *
"ns" - unconditional snapshot filter (no snapshots selected from ranges)
+ *
"e(G:A:V)" - predicate filter (leaves out G:A:V from range, if hit, V can be range)
+ *
+ * Example filter expression: "h(5);s;e(org.foo:bar:1) will cause: ranges are filtered for "top 5" (instead
+ * full range), snapshots are banned if root project is not a snapshot, and if range for org.foo:bar is
+ * being processed, version 1 is omitted. Value in this property builds
+ * org.eclipse.aether.collection.VersionFilter instance.
+ *
+ * @since 4.0.0
+ */
+ @Config
+ public static final String MAVEN_VERSION_FILTER = "maven.session.versionFilter";
+
+ /**
+ * User property for chained LRM: the new "head" local repository to use, and "push" the existing into tail.
+ * Similar to maven.repo.local.tail, this property may contain comma separated list of paths to be
+ * used as local repositories (combine with chained local repository), but while latter is "appending" this
+ * one is "prepending".
+ *
+ * @since 4.0.0
+ */
+ @Config
+ public static final String MAVEN_REPO_LOCAL_HEAD = "maven.repo.local.head";
+
+ /**
+ * User property for chained LRM: list of "tail" local repository paths (separated by comma), to be used with
+ * org.eclipse.aether.util.repository.ChainedLocalRepositoryManager.
+ * Default value: null, no chained LRM is used.
+ *
+ * @since 3.9.0
+ */
+ @Config
+ public static final String MAVEN_REPO_LOCAL_TAIL = "maven.repo.local.tail";
+
+ /**
+ * User property for chained LRM: whether to ignore "availability check" in tail or not. Usually you do want
+ * to ignore it. This property is mapped onto corresponding Resolver 2.x property, is like a synonym for it.
+ * Default value: true.
+ *
+ * @since 3.9.0
+ * @see Resolver Configuration: aether.chainedLocalRepository.ignoreTailAvailability
+ */
+ @Config
+ public static final String MAVEN_REPO_LOCAL_TAIL_IGNORE_AVAILABILITY = "maven.repo.local.tail.ignoreAvailability";
+
+ /**
+ * User property for reverse dependency tree. If enabled, Maven will record ".tracking" directory into local
+ * repository with "reverse dependency tree", essentially explaining WHY given artifact is present in local
+ * repository.
+ * Default: false, will not record anything.
+ *
+ * @since 3.9.0
+ */
+ @Config(defaultValue = "false")
+ public static final String MAVEN_REPO_LOCAL_RECORD_REVERSE_TREE = "maven.repo.local.recordReverseTree";
+
+ /**
+ * User property for selecting dependency manager behaviour regarding transitive dependencies and dependency
+ * management entries in their POMs. Maven 3 targeted full backward compatibility with Maven 2. Hence, it ignored
+ * dependency management entries in transitive dependency POMs. Maven 4 enables "transitivity" by default. Hence
+ * unlike Maven 3, it obeys dependency management entries deep in the dependency graph as well.
+ *
+ * Default: "true".
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "true")
+ public static final String MAVEN_RESOLVER_DEPENDENCY_MANAGER_TRANSITIVITY =
+ "maven.resolver.dependencyManagerTransitivity";
+
+ /**
+ * Resolver transport to use.
+ * Can be default, wagon, apache, jdk or auto.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "default")
+ public static final String MAVEN_RESOLVER_TRANSPORT = "maven.resolver.transport";
+
+ /**
+ * Plugin validation level.
+ *
+ * @since 3.9.2
+ */
+ @Config(defaultValue = "inline")
+ public static final String MAVEN_PLUGIN_VALIDATION = "maven.plugin.validation";
+
+ /**
+ * Plugin validation exclusions.
+ *
+ * @since 3.9.6
+ */
+ @Config
+ public static final String MAVEN_PLUGIN_VALIDATION_EXCLUDES = "maven.plugin.validation.excludes";
+
+ /**
+ * ProjectBuilder parallelism.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Integer", defaultValue = "cores/2 + 1")
+ public static final String MAVEN_MODEL_BUILDER_PARALLELISM = "maven.modelBuilder.parallelism";
+
+ /**
+ * User property for enabling/disabling the consumer POM feature.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "true")
+ public static final String MAVEN_CONSUMER_POM = "maven.consumer.pom";
+
+ /**
+ * User property for controlling "maven personality". If activated Maven will behave
+ * like the previous major version, Maven 3.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "false")
+ public static final String MAVEN_MAVEN3_PERSONALITY = "maven.maven3Personality";
+
+ /**
+ * User property for disabling version resolver cache.
+ *
+ * @since 3.0.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "false")
+ public static final String MAVEN_VERSION_RESOLVER_NO_CACHE = "maven.versionResolver.noCache";
+
+ /**
+ * User property for overriding calculated "build number" for snapshot deploys. Caution: this property should
+ * be RARELY used (if used at all). It may help in special cases like "aligning" a reactor build subprojects
+ * build numbers to perform a "snapshot lock down". Value given here must be maxRemoteBuildNumber + 1
+ * or greater, otherwise build will fail. How the number to be obtained is left to user (ie by inspecting
+ * snapshot repository metadata or alike).
+ *
+ * Note: this feature is present in Maven 3.9.7 but with different key: maven.buildNumber. In Maven 4
+ * as part of cleanup effort this key was renamed to properly reflect its purpose.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Integer")
+ public static final String MAVEN_DEPLOY_SNAPSHOT_BUILD_NUMBER = "maven.deploy.snapshot.buildNumber";
+
+ /**
+ * User property for controlling whether build POMs are deployed alongside consumer POMs.
+ * When set to false, only the consumer POM will be deployed, and the build POM
+ * will be excluded from deployment. This is useful to avoid deploying internal build information
+ * that is not needed by consumers of the artifact.
+ *
+ * Default: "true".
+ *
+ * @since 4.1.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "true")
+ public static final String MAVEN_DEPLOY_BUILD_POM = "maven.deploy.buildPom";
+
+ /**
+ * User property used to store the build timestamp.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.time.Instant")
+ public static final String MAVEN_START_INSTANT = "maven.startInstant";
+
+ /**
+ * Max number of problems for each severity level retained by the model builder.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Integer", defaultValue = "100")
+ public static final String MAVEN_BUILDER_MAX_PROBLEMS = "maven.builder.maxProblems";
+
+ /**
+ * Configuration property for version range resolution used metadata "nature".
+ * It may contain following string values:
+ *
+ *
"auto" - decision done based on range being resolver: if any boundary is snapshot, use "release_or_snapshot", otherwise "release"
+ *
"release_or_snapshot" - the default
+ *
"release" - query only release repositories to discover versions
+ *
"snapshot" - query only snapshot repositories to discover versions
+ *
+ * Default (when unset) is existing Maven behaviour: "release_or_snapshots".
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "release_or_snapshot")
+ public static final String MAVEN_VERSION_RANGE_RESOLVER_NATURE_OVERRIDE =
+ "maven.versionRangeResolver.natureOverride";
+
+ /**
+ * Comma-separated list of XML contexts/fields to intern during POM parsing for memory optimization.
+ * When not specified, a default set of commonly repeated contexts will be used.
+ * Example: "groupId,artifactId,version,scope,type"
+ *
+ * @since 4.0.0
+ */
+ @Config
+ public static final String MAVEN_MODEL_BUILDER_INTERNS = "maven.modelBuilder.interns";
+
+ /**
+ * All system properties used by Maven Logger start with this prefix.
+ *
+ * @since 4.0.0
+ */
+ public static final String MAVEN_LOGGER_PREFIX = "maven.logger.";
+
+ /**
+ * Default log level for all instances of SimpleLogger. Must be one of ("trace", "debug", "info",
+ * "warn", "error" or "off"). If not specified, defaults to "info".
+ *
+ * @since 4.0.0
+ */
+ @Config
+ public static final String MAVEN_LOGGER_DEFAULT_LOG_LEVEL = MAVEN_LOGGER_PREFIX + "defaultLogLevel";
+
+ /**
+ * Set to true if you want the current date and time to be included in output messages. Default is false.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "false")
+ public static final String MAVEN_LOGGER_SHOW_DATE_TIME = MAVEN_LOGGER_PREFIX + "showDateTime";
+
+ /**
+ * The date and time format to be used in the output messages. The pattern describing the date and
+ * time format is defined by SimpleDateFormat. If the format is not specified or is invalid, the
+ * number of milliseconds since start up will be output.
+ *
+ * @since 4.0.0
+ */
+ @Config
+ public static final String MAVEN_LOGGER_DATE_TIME_FORMAT = MAVEN_LOGGER_PREFIX + "dateTimeFormat";
+
+ /**
+ * If you would like to output the current thread id, then set to true. Defaults to false.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "false")
+ public static final String MAVEN_LOGGER_SHOW_THREAD_ID = MAVEN_LOGGER_PREFIX + "showThreadId";
+
+ /**
+ * Set to true if you want to output the current thread name. Defaults to true.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "true")
+ public static final String MAVEN_LOGGER_SHOW_THREAD_NAME = MAVEN_LOGGER_PREFIX + "showThreadName";
+
+ /**
+ * Set to true if you want the Logger instance name to be included in output messages. Defaults to true.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "true")
+ public static final String MAVEN_LOGGER_SHOW_LOG_NAME = MAVEN_LOGGER_PREFIX + "showLogName";
+
+ /**
+ * Set to true if you want the last component of the name to be included in output messages. Defaults to false.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "false")
+ public static final String MAVEN_LOGGER_SHOW_SHORT_LOG_NAME = MAVEN_LOGGER_PREFIX + "showShortLogName";
+
+ /**
+ * The output target which can be the path to a file, or the special values "System.out" and "System.err".
+ * Default is "System.err".
+ *
+ * @since 4.0.0
+ */
+ @Config
+ public static final String MAVEN_LOGGER_LOG_FILE = MAVEN_LOGGER_PREFIX + "logFile";
+
+ /**
+ * Should the level string be output in brackets? Defaults to false.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "false")
+ public static final String MAVEN_LOGGER_LEVEL_IN_BRACKETS = MAVEN_LOGGER_PREFIX + "levelInBrackets";
+
+ /**
+ * The string value output for the warn level. Defaults to WARN.
+ *
+ * @since 4.0.0
+ */
+ @Config(defaultValue = "WARN")
+ public static final String MAVEN_LOGGER_WARN_LEVEL = MAVEN_LOGGER_PREFIX + "warnLevelString";
+
+ /**
+ * If the output target is set to "System.out" or "System.err" (see preceding entry), by default, logs will
+ * be output to the latest value referenced by System.out/err variables. By setting this parameter to true,
+ * the output stream will be cached, i.e. assigned once at initialization time and re-used independently of
+ * the current value referenced by System.out/err.
+ *
+ * @since 4.0.0
+ */
+ @Config(type = "java.lang.Boolean", defaultValue = "false")
+ public static final String MAVEN_LOGGER_CACHE_OUTPUT_STREAM = MAVEN_LOGGER_PREFIX + "cacheOutputStream";
+
+ /**
+ * maven.logger.log.a.b.c - Logging detail level for a SimpleLogger instance named "a.b.c". Right-side value
+ * must be one of "trace", "debug", "info", "warn", "error" or "off". When a logger named "a.b.c" is initialized,
+ * its level is assigned from this property. If unspecified, the level of nearest parent logger will be used,
+ * and if none is set, then the value specified by {@code maven.logger.defaultLogLevel} will be used.
+ *
+ * @since 4.0.0
+ */
+ public static final String MAVEN_LOGGER_LOG_PREFIX = MAVEN_LOGGER_PREFIX + "log.";
+
+ private Constants() {}
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java
new file mode 100644
index 000000000000..95dc5d689efa
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * A result of collecting, flattening, and resolving {@link DependencyCoordinates}s.
+ * Dependency is the output of the collection process, which builds the graph of dependencies,
+ * followed by flattening and resolution.
+ * The version selection is done for each dependency during the collection phase.
+ * The flatten phase keeps only a single version per ({@code groupId}, {@code artifactId}) pair.
+ * The resolution phase actually downloads the dependencies (or artifacts) that have been computed.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface Dependency extends Artifact {
+ /**
+ * {@return the type of the dependency}.
+ * A dependency can be a JAR file,
+ * a modular-JAR if it is intended to be placed on the module path,
+ * a JAR containing test classes, etc.
+ *
+ * @see DependencyCoordinates#getType()
+ */
+ @Nonnull
+ Type getType();
+
+ /**
+ * {@return the time at which the dependency will be used}.
+ * It may be, for example, at compile time only, at run time or at test time.
+ *
+ * @see DependencyCoordinates#getScope()
+ */
+ @Nonnull
+ DependencyScope getScope();
+
+ /**
+ * Returns whether the dependency is optional or mandatory.
+ * Unlike {@link DependencyCoordinates}, the obligation of a {@code Dependency} is always present.
+ * The value is computed during the dependencies collection phase.
+ *
+ * @return {@code true} if the dependency is optional, or {@code false} if mandatory
+ * @see DependencyCoordinates#getOptional()
+ */
+ boolean isOptional();
+
+ /**
+ * {@return coordinates with the same identifiers as this dependency}.
+ */
+ @Nonnull
+ @Override
+ DependencyCoordinates toCoordinates();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinates.java b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinates.java
new file mode 100644
index 000000000000..cbcc264db653
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinates.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Collection;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+
+/**
+ * {@code ArtifactCoordinates} completed with information about how the artifact will be used.
+ * This information includes the dependency type (main classes, test classes, etc.),
+ * a scope (compile, runtime etc.), an obligation (whether the dependency
+ * is optional or mandatory), and possible exclusions for transitive dependencies.
+ * The {@linkplain #getVersionConstraint() version} and the {@linkplain #getOptional() obligation}
+ * may not be defined precisely.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface DependencyCoordinates extends ArtifactCoordinates {
+ /**
+ * {@return the type of the dependency}
+ * A dependency can be a JAR file,
+ * a modular-JAR if it is intended to be placed on the module path,
+ * a JAR containing test classes, a POM file, etc.
+ */
+ @Nonnull
+ Type getType();
+
+ /**
+ * {@return the time at which the dependency will be used}
+ * It may be, for example, at compile time only, at run time, or at test time.
+ */
+ @Nonnull
+ DependencyScope getScope();
+
+ /**
+ * Returns whether the dependency is optional, mandatory, or of unspecified obligation.
+ *
+ * @return {@code Boolean.TRUE} and {@code Boolean.FALSE} if optional, or {@code null} if unspecified
+ */
+ @Nullable
+ Boolean getOptional();
+
+ /**
+ * {@return transitive dependencies to exclude}
+ */
+ @Nonnull
+ Collection getExclusions();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyScope.java b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyScope.java
new file mode 100644
index 000000000000..f9f788e00316
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyScope.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Indicates when the dependency will be used.
+ * For example, it may be at compile time only, at runtime, or at test time.
+ * For a given dependency, the scope is directly derived from the
+ * {@link org.apache.maven.api.model.Dependency#getScope()} and will be used when using {@link PathScope}
+ * and the {@link org.apache.maven.api.services.DependencyResolver}.
+ *
+ * @since 4.0.0
+ * @see org.apache.maven.api.model.Dependency#getScope()
+ * @see org.apache.maven.api.services.DependencyResolver
+ */
+@Experimental
+@Immutable
+public enum DependencyScope {
+
+ /**
+ * None. Allows you to declare dependencies (for example to alter reactor build order) but in reality dependencies
+ * in this scope are not part of any path scope.
+ */
+ NONE("none", false),
+
+ /**
+ * Undefined. When no scope is explicitly given, UNDEFINED will be used, but its meaning will depend on
+ * whether the DependencyCoordinates is used in dependency management, in which case it means the scope is not
+ * explicitly managed by this managed dependency, or as a real dependency, in which case, the scope
+ * will default to {@link #COMPILE}.
+ */
+ UNDEFINED("", false),
+
+ /**
+ * Compile only.
+ */
+ COMPILE_ONLY("compile-only", false),
+
+ /**
+ * Compile, runtime and test.
+ */
+ COMPILE("compile", true),
+
+ /**
+ * Runtime and test.
+ */
+ RUNTIME("runtime", true),
+
+ /**
+ * Provided.
+ */
+ PROVIDED("provided", false),
+
+ /**
+ * Test compile only.
+ */
+ TEST_ONLY("test-only", false),
+
+ /**
+ * Test compile and test runtime.
+ */
+ TEST("test", false),
+
+ /**
+ * Test runtime.
+ */
+ TEST_RUNTIME("test-runtime", false),
+
+ /**
+ * System scope.
+ */
+ SYSTEM("system", false);
+
+ private static final Map IDS = Collections.unmodifiableMap(
+ Stream.of(DependencyScope.values()).collect(Collectors.toMap(s -> s.id, s -> s)));
+
+ /**
+ * {@return the dependency scope for the given identifier, or {@code null} if none}.
+ * The identifiers are usually in lower cases with {@code '-'} instead of {@code '_'}
+ * as word separator.
+ *
+ * @param id the identifier of the scope (case-sensitive)
+ */
+ public static DependencyScope forId(String id) {
+ return IDS.get(id);
+ }
+
+ private final String id;
+ private final boolean transitive;
+
+ DependencyScope(String id, boolean transitive) {
+ this.id = id;
+ this.transitive = transitive;
+ }
+
+ /**
+ * The {@code id} uniquely represents a value for this extensible enum.
+ * This id should be used to compute the equality and hash code for the instance.
+ *
+ * @return the id
+ */
+ @Nonnull
+ public String id() {
+ return id;
+ }
+
+ public boolean isTransitive() {
+ return transitive;
+ }
+
+ public boolean is(String id) {
+ return id().equals(id);
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/DownloadedArtifact.java b/api/maven-api-core/src/main/java/org/apache/maven/api/DownloadedArtifact.java
new file mode 100644
index 000000000000..f01cb2acb99e
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/DownloadedArtifact.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.nio.file.Path;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+
+/**
+ * An {@link Artifact} that has been resolved, i.e. downloaded to the local repository.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface DownloadedArtifact extends Artifact {
+
+ /**
+ * {@return the a path to the file that has been downloaded to the file system}.
+ */
+ Path getPath();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/DownloadedDependency.java b/api/maven-api-core/src/main/java/org/apache/maven/api/DownloadedDependency.java
new file mode 100644
index 000000000000..7a1e4174ed75
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/DownloadedDependency.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+
+/**
+ * A {@link Dependency} that has been resolved, i.e. downloaded to the local repository.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface DownloadedDependency extends Dependency, DownloadedArtifact {}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Event.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Event.java
new file mode 100644
index 000000000000..0323abd43579
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Event.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Optional;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Event sent by maven during various phases of the build process.
+ * Such events can be listened to using {@link Listener}s objects
+ * registered in the {@link Session}.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface Event {
+
+ /**
+ * Gets the type of the event.
+ *
+ * @return the type of the event, never {@code null}
+ */
+ @Nonnull
+ EventType getType();
+
+ /**
+ * Gets the session from which this event originates.
+ *
+ * @return the current session, never {@code null}
+ */
+ @Nonnull
+ Session getSession();
+
+ /**
+ * Gets the current project (if any).
+ *
+ * @return the current project or {@code empty()} if not applicable
+ */
+ @Nonnull
+ Optional getProject();
+
+ /**
+ * Gets the current mojo execution (if any).
+ *
+ * @return the current mojo execution or {@code empty()} if not applicable
+ */
+ @Nonnull
+ Optional getMojoExecution();
+
+ /**
+ * Gets the exception that caused the event (if any).
+ *
+ * @return the exception or {@code empty()} if none
+ */
+ Optional getException();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/EventType.java b/api/maven-api-core/src/main/java/org/apache/maven/api/EventType.java
new file mode 100644
index 000000000000..63d3479fbf39
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/EventType.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * The possible types of execution events.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public enum EventType {
+ PROJECT_DISCOVERY_STARTED,
+ SESSION_STARTED,
+ SESSION_ENDED,
+ PROJECT_SKIPPED,
+ PROJECT_STARTED,
+ PROJECT_SUCCEEDED,
+ PROJECT_FAILED,
+ MOJO_SKIPPED,
+ MOJO_STARTED,
+ MOJO_SUCCEEDED,
+ MOJO_FAILED,
+ FORK_STARTED,
+ FORK_SUCCEEDED,
+ FORK_FAILED,
+ FORKED_PROJECT_STARTED,
+ FORKED_PROJECT_SUCCEEDED,
+ FORKED_PROJECT_FAILED,
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java
new file mode 100644
index 000000000000..99f9263c32d4
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nullable;
+
+/**
+ * A dependency exclusion.
+ *
+ * @since 4.0.0
+ * @see DependencyCoordinates#getExclusions()
+ */
+@Experimental
+public interface Exclusion {
+ @Nullable
+ String getGroupId();
+
+ @Nullable
+ String getArtifactId();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/ExtensibleEnum.java b/api/maven-api-core/src/main/java/org/apache/maven/api/ExtensibleEnum.java
new file mode 100644
index 000000000000..4b8b74ca0ba9
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/ExtensibleEnum.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Interface that defines some kind of enums that can be extended by Maven plugins or extensions.
+ *
+ * Implementation must have {@code equals()} and {@code hashCode()} implemented, so implementations of this interface
+ * can be used as keys.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface ExtensibleEnum {
+
+ /**
+ * The {@code id} uniquely represents a value for this extensible enum.
+ * This id should be used to compute the equality and hash code for the instance.
+ *
+ * @return the id
+ */
+ @Nonnull
+ String id();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/ExtensibleEnums.java b/api/maven-api-core/src/main/java/org/apache/maven/api/ExtensibleEnums.java
new file mode 100644
index 000000000000..75892c765140
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/ExtensibleEnums.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * Utility class for creating extensible enum implementations.
+ * This class provides factory methods for creating instances of extensible enums
+ * such as Language, PathScope, and ProjectScope.
+ *
+ * @since 4.0.0
+ */
+abstract class ExtensibleEnums {
+
+ /**
+ * Creates a new Language instance with the specified ID.
+ *
+ * @param id the identifier for the language
+ * @return a new Language instance
+ */
+ static Language language(String id) {
+ return new DefaultLanguage(id);
+ }
+
+ /**
+ * Creates a new PathScope instance with the specified ID, project scope, and dependency scopes.
+ *
+ * @param id the identifier for the path scope
+ * @param projectScope the project scope associated with this path scope
+ * @param dependencyScopes the dependency scopes associated with this path scope
+ * @return a new PathScope instance
+ */
+ static PathScope pathScope(String id, ProjectScope projectScope, DependencyScope... dependencyScopes) {
+ return new DefaultPathScope(id, projectScope, dependencyScopes);
+ }
+
+ /**
+ * Creates a new ProjectScope instance with the specified ID.
+ *
+ * @param id the identifier for the project scope
+ * @return a new ProjectScope instance
+ */
+ static ProjectScope projectScope(String id) {
+ return new DefaultProjectScope(id);
+ }
+
+ /**
+ * Base implementation of the ExtensibleEnum interface.
+ * Provides common functionality for all extensible enum implementations.
+ */
+ private static class DefaultExtensibleEnum implements ExtensibleEnum {
+
+ private final String id;
+
+ /**
+ * Creates a new DefaultExtensibleEnum with the specified ID.
+ *
+ * @param id the identifier for this enum value, must not be null
+ */
+ DefaultExtensibleEnum(String id) {
+ this.id = Objects.requireNonNull(id);
+ }
+
+ /**
+ * Returns the identifier for this enum value.
+ *
+ * @return the identifier
+ */
+ @Override
+ public String id() {
+ return id;
+ }
+
+ @Override
+ public int hashCode() {
+ return id().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj != null && getClass() == obj.getClass() && id().equals(((DefaultExtensibleEnum) obj).id());
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + id() + "]";
+ }
+ }
+
+ /**
+ * Implementation of the PathScope interface.
+ */
+ private static class DefaultPathScope extends DefaultExtensibleEnum implements PathScope {
+ private final ProjectScope projectScope;
+ private final Set dependencyScopes;
+
+ /**
+ * Creates a new DefaultPathScope with the specified ID, project scope, and dependency scopes.
+ *
+ * @param id the identifier for this path scope
+ * @param projectScope the project scope associated with this path scope, must not be null
+ * @param dependencyScopes the dependency scopes associated with this path scope, must not be null
+ */
+ DefaultPathScope(String id, ProjectScope projectScope, DependencyScope... dependencyScopes) {
+ super(id);
+ this.projectScope = Objects.requireNonNull(projectScope);
+ this.dependencyScopes =
+ Collections.unmodifiableSet(new HashSet<>(Arrays.asList(Objects.requireNonNull(dependencyScopes))));
+ }
+
+ /**
+ * Returns the project scope associated with this path scope.
+ *
+ * @return the project scope
+ */
+ @Override
+ public ProjectScope projectScope() {
+ return projectScope;
+ }
+
+ /**
+ * Returns the dependency scopes associated with this path scope.
+ *
+ * @return an unmodifiable set of dependency scopes
+ */
+ @Override
+ public Set dependencyScopes() {
+ return dependencyScopes;
+ }
+ }
+
+ /**
+ * Implementation of the ProjectScope interface.
+ */
+ private static class DefaultProjectScope extends DefaultExtensibleEnum implements ProjectScope {
+
+ /**
+ * Creates a new DefaultProjectScope with the specified ID.
+ *
+ * @param id the identifier for this project scope
+ */
+ DefaultProjectScope(String id) {
+ super(id);
+ }
+ }
+
+ /**
+ * Implementation of the Language interface.
+ */
+ private static class DefaultLanguage extends DefaultExtensibleEnum implements Language {
+
+ /**
+ * Creates a new DefaultLanguage with the specified ID.
+ *
+ * @param id the identifier for this language
+ */
+ DefaultLanguage(String id) {
+ super(id);
+ }
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java b/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java
new file mode 100644
index 000000000000..63188ec6fd37
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java
@@ -0,0 +1,392 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import javax.tools.DocumentationTool;
+import javax.tools.JavaFileManager;
+import javax.tools.StandardLocation;
+
+import java.io.File;
+import java.nio.file.Path;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.StringJoiner;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * The option of a Java command-line tool where to place the paths to some dependencies.
+ * A {@code PathType} can identify the class path, the module path, the patches for a specific module,
+ * or another kind of path.
+ *
+ *
One path type is handled in a special way: unlike other options,
+ * the paths specified in a {@code --patch-module} Java option is effective only for a specified module.
+ * This type is created by calls to {@link #patchModule(String)} and a new instance must be created for
+ * every module to patch.
+ *
+ *
Path types are often exclusive. For example, a dependency should not be both on the Java class path
+ * and on the Java module path.
+ *
+ *
Relationship with Java compiler standard location
+ * This enumeration is closely related to the {@link JavaFileManager.Location} enumerations.
+ * A difference is that the latter enumerates input and output files, while {@code JavaPathType}
+ * enumerates only input dependencies. Another difference is that {@code JavaPathType} contains
+ * some enumeration values used only at runtime and therefore not available in {@code javax.tool},
+ * such as agent paths.
+ *
+ * @see org.apache.maven.api.services.DependencyResolverResult#getDispatchedPaths()
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public enum JavaPathType implements PathType {
+ /**
+ * The path identified by the Java {@code --class-path} option.
+ * Used for compilation, execution and Javadoc among others.
+ * The Java tools location is {@link StandardLocation#CLASS_PATH}.
+ *
+ *
Context-sensitive interpretation
+ * A dependency with this path type will not necessarily be placed on the class path.
+ * There are two circumstances where the dependency may nevertheless be placed somewhere else:
+ *
+ *
+ *
If {@link #MODULES} path type is also set, then the dependency can be placed either on the
+ * class path or on the module path, but only one of those. The choice is up to the plugin,
+ * possibly using heuristic rules (Maven 3 behavior).
+ *
If a {@link #patchModule(String)} is also set and the main JAR file is placed on the module path,
+ * then the test dependency will be placed on the Java {@code --patch-module} option instead of the
+ * class path.
+ *
+ */
+ CLASSES(StandardLocation.CLASS_PATH, "--class-path"),
+
+ /**
+ * The path identified by the Java {@code --module-path} option.
+ * Used for compilation, execution and Javadoc among others.
+ * The Java tools location is {@link StandardLocation#MODULE_PATH}.
+ *
+ *
Context-sensitive interpretation
+ * A dependency with this flag will not necessarily be placed on the module path.
+ * There are two circumstances where the dependency may nevertheless be placed somewhere else:
+ *
+ *
+ *
If {@link #CLASSES} path type is also set, then the dependency should be placed on the
+ * module path, but is also compatible with placement on the class path. Compatibility can
+ * be achieved, for example, by repeating in the {@code META-INF/services/} directory the services
+ * that are declared in the {@code module-info.class} file. In that case, the path type can be chosen
+ * by the plugin.
+ *
If a {@link #patchModule(String)} is also set and the main JAR file is placed on the module path,
+ * then the test dependency will be placed on the Java {@code --patch-module} option instead of the
+ * {@code --module-path} option.
+ *
+ */
+ MODULES(StandardLocation.MODULE_PATH, "--module-path"),
+
+ /**
+ * The path identified by the Java {@code --upgrade-module-path} option.
+ * The Java tools location is {@link StandardLocation#UPGRADE_MODULE_PATH}.
+ */
+ UPGRADE_MODULES(StandardLocation.UPGRADE_MODULE_PATH, "--upgrade-module-path"),
+
+ /**
+ * The path identified by the Java {@code --patch-module} option.
+ * The Java tools location is {@link StandardLocation#PATCH_MODULE_PATH}.
+ *
+ * Note that this option is incomplete, because it must be followed by a module name.
+ * Use this type only when the module to patch is unknown.
+ *
+ * @see #patchModule(String)
+ */
+ PATCH_MODULE(StandardLocation.PATCH_MODULE_PATH, "--patch-module"),
+
+ /**
+ * The path identified by the Java {@code --processor-path} option.
+ * The Java tools location is {@link StandardLocation#ANNOTATION_PROCESSOR_PATH}.
+ */
+ PROCESSOR_CLASSES(StandardLocation.ANNOTATION_PROCESSOR_PATH, "--processor-path"),
+
+ /**
+ * The path identified by the Java {@code --processor-module-path} option.
+ * The Java tools location is {@link StandardLocation#ANNOTATION_PROCESSOR_MODULE_PATH}.
+ */
+ PROCESSOR_MODULES(StandardLocation.ANNOTATION_PROCESSOR_MODULE_PATH, "--processor-module-path"),
+
+ /**
+ * The path identified by the Java {@code -agentpath} option.
+ */
+ AGENT(null, "-agentpath"),
+
+ /**
+ * The path identified by the Javadoc {@code -doclet} option.
+ * The Java tools location is {@link DocumentationTool.Location#DOCLET_PATH}.
+ */
+ DOCLET(DocumentationTool.Location.DOCLET_PATH, "-doclet"),
+
+ /**
+ * The path identified by the Javadoc {@code -tagletpath} option.
+ * The Java tools location is {@link DocumentationTool.Location#TAGLET_PATH}.
+ */
+ TAGLETS(DocumentationTool.Location.TAGLET_PATH, "-tagletpath");
+
+ /**
+ * Creates a path identified by the Java {@code --patch-module} option.
+ * Contrarily to the other types of paths, this path is applied to only
+ * one specific module. Used for compilation and execution among others.
+ *
+ *
Context-sensitive interpretation
+ * This path type makes sense only when a main module is added on the module path by another dependency.
+ * In no main module is found, the patch dependency may be added on the class path or module path
+ * depending on whether {@link #CLASSES} or {@link #MODULES} is present.
+ *
+ * @param moduleName name of the module on which to apply the path
+ * @return an identification of the patch-module path for the given module.
+ *
+ * @see Modular#moduleName()
+ */
+ @Nonnull
+ public static Modular patchModule(@Nonnull String moduleName) {
+ return PATCH_MODULE.new Modular(moduleName);
+ }
+
+ /**
+ * The {@code javax.tool} enumeration value corresponding to this {@code JavaPathType}, or {@code null} if none.
+ *
+ * @see #location()
+ */
+ private final JavaFileManager.Location location;
+
+ /**
+ * The tools option for this path, or {@code null} if none.
+ *
+ * @see #option()
+ */
+ private final String option;
+
+ /**
+ * Creates a new enumeration value for a path associated to the given tool option.
+ *
+ * @param location the {@code javax.tool} enumeration value, or {@code null} if none.
+ * @param option the Java tools option for this path, or {@code null} if none
+ */
+ JavaPathType(JavaFileManager.Location location, String option) {
+ this.location = location;
+ this.option = option;
+ }
+
+ /**
+ * Returns the unique name of this path type.
+ *
+ * @return the programmatic name of this enumeration value
+ */
+ @Override
+ public String id() {
+ return name();
+ }
+
+ /**
+ * Returns the identification of this path in the {@code javax.tool} API.
+ * The value may be an instance of {@link StandardLocation} or {@link DocumentationTool.Location},
+ * depending on which tool will use this location.
+ *
+ * @return the {@code javax.tool} enumeration value corresponding to this {@code JavaPathType}
+ */
+ public Optional location() {
+ return Optional.ofNullable(location);
+ }
+
+ /**
+ * Returns the path type associated to the given {@code javax.tool} location.
+ * This method is the converse of {@link #location()}.
+ *
+ * @param location identification of a path in the {@code javax.tool} API
+ * @return Java path type associated to the given location
+ */
+ public static Optional valueOf(JavaFileManager.Location location) {
+ for (JavaPathType type : JavaPathType.values()) {
+ if (location.equals(type.location)) {
+ return Optional.of(type);
+ }
+ }
+ return Optional.empty();
+ }
+
+ /**
+ * Returns the name of the tool option for this path. For example, if this path type
+ * is {@link #MODULES}, then this method returns {@code "--module-path"}. The option
+ * does not include the {@linkplain Modular#moduleName() module name} on which it applies.
+ *
+ * @return the name of the tool option for this path type
+ */
+ @Nonnull
+ @Override
+ public Optional option() {
+ return Optional.ofNullable(option);
+ }
+
+ /**
+ * Returns the option followed by a string representation of the given path elements.
+ * For example, if this type is {@link #MODULES}, then the option is {@code "--module-path"}
+ * followed by the specified path elements.
+ *
+ * @param paths the path to format as a tool option
+ * @return the option associated to this path type followed by the given path elements,
+ * or an empty array if there is no path element
+ * @throws IllegalStateException if no option is associated to this path type
+ */
+ @Nonnull
+ @Override
+ public String[] option(Iterable extends Path> paths) {
+ return format(null, paths);
+ }
+
+ /**
+ * Implementation shared with {@link Modular}.
+ */
+ final String[] format(String moduleName, Iterable extends Path> paths) {
+ if (option == null) {
+ throw new IllegalStateException("No option is associated to this path type.");
+ }
+ String prefix = (moduleName == null) ? "\"" : (moduleName + "=\"");
+ StringJoiner joiner = new StringJoiner(File.pathSeparator, prefix, "\"");
+ joiner.setEmptyValue("");
+ for (Path p : paths) {
+ joiner.add(p.toString());
+ }
+ String value = joiner.toString();
+ if (value.isEmpty()) {
+ return new String[0];
+ }
+ return new String[] {option, value};
+ }
+
+ /**
+ * {@return a string representation of this path type for debugging purposes}.
+ */
+ @Override
+ public String toString() {
+ return "PathType[" + id() + "]";
+ }
+
+ /**
+ * Type of path which is applied to only one specific Java module.
+ * The main case is the Java {@code --patch-module} option.
+ *
+ * @see #PATCH_MODULE
+ * @see #patchModule(String)
+ */
+ public final class Modular implements PathType {
+ /**
+ * Name of the module for which a path is specified.
+ */
+ @Nonnull
+ private final String moduleName;
+
+ /**
+ * Creates a new path type for the specified module.
+ *
+ * @param moduleName name of the module for which a path is specified
+ */
+ private Modular(@Nonnull String moduleName) {
+ this.moduleName = Objects.requireNonNull(moduleName);
+ }
+
+ /**
+ * Returns the type of path without indication about the target module.
+ * This is usually {@link #PATCH_MODULE}.
+ *
+ * @return type of path without indication about the target module
+ */
+ @Nonnull
+ public JavaPathType rawType() {
+ return JavaPathType.this;
+ }
+
+ /**
+ * Returns the name of the tool option for this path, including the module name.
+ *
+ * @return name of the tool option for this path, including the module name
+ */
+ @Override
+ public String id() {
+ return JavaPathType.this.name() + ":" + moduleName;
+ }
+
+ /**
+ * Returns the name of the tool option for this path, not including the module name.
+ *
+ * @return name of the tool option for this path, not including the module name
+ */
+ @Nonnull
+ @Override
+ public String name() {
+ return JavaPathType.this.name();
+ }
+
+ /**
+ * Returns the name of the module for which a path is specified
+ *
+ * @return name of the module for which a path is specified
+ */
+ @Nonnull
+ public String moduleName() {
+ return moduleName;
+ }
+
+ /**
+ * Returns the name of the tool option for this path.
+ * The option does not include the {@linkplain #moduleName() module name} on which it applies.
+ *
+ * @return the name of the tool option for this path type
+ */
+ @Nonnull
+ @Override
+ public Optional option() {
+ return JavaPathType.this.option();
+ }
+
+ /**
+ * Returns the option followed by a string representation of the given path elements.
+ * The path elements are separated by an option-specific or platform-specific separator.
+ * If the given {@code paths} argument contains no element, then this method returns an empty string.
+ *
+ * @param paths the path to format as a string
+ * @return the option associated to this path type followed by the given path elements,
+ * or an empty array if there is no path element.
+ */
+ @Nonnull
+ @Override
+ public String[] option(Iterable extends Path> paths) {
+ return format(moduleName, paths);
+ }
+
+ /**
+ * Returns the programmatic name of this path type, including the module to patch.
+ * For example, if this type was created by {@code JavaPathType.patchModule("foo.bar")},
+ * then this method returns {@code "PathType[PATCH_MODULE:foo.bar]")}.
+ *
+ * @return the programmatic name together with the module name on which it applies
+ */
+ @Nonnull
+ @Override
+ public String toString() {
+ return "PathType[" + id() + "]";
+ }
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/JavaToolchain.java b/api/maven-api-core/src/main/java/org/apache/maven/api/JavaToolchain.java
new file mode 100644
index 000000000000..a4addddac79a
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/JavaToolchain.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Represents a Java toolchain in the Maven build system.
+ *
+ *
A Java toolchain is a specific type of toolchain that provides access
+ * to Java development tools, such as the Java compiler and Java runtime
+ * environment. This interface allows users to define and configure
+ * Java-related toolchains that can be utilized during the build process
+ * in Maven.
+ *
+ *
Java toolchains are defined in the Maven toolchains.xml file and can
+ * be referenced in the project's POM file. This enables developers to
+ * specify the exact versions of Java tools they wish to use, ensuring
+ * consistency across different build environments.
+ *
+ * @since 4.0.0
+ * @see Toolchain
+ * @see org.apache.maven.api.services.ToolchainManager
+ */
+@Experimental
+public interface JavaToolchain extends Toolchain {
+
+ String getJavaHome();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Language.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Language.java
new file mode 100644
index 000000000000..39a5c46e6ae6
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Language.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+
+import static org.apache.maven.api.ExtensibleEnums.language;
+
+/**
+ * Language.
+ *
+ * This extensible enum has two defined values, {@link #NONE} and {@link #JAVA_FAMILY},
+ * but can be extended by registering a {@code org.apache.maven.api.spi.LanguageProvider}.
+ *
+ * Implementation must have {@code equals()} and {@code hashCode()} implemented, so implementations of this interface
+ * can be used as keys.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+@SuppressWarnings("checkstyle:InterfaceIsType")
+public interface Language extends ExtensibleEnum {
+
+ /**
+ * The "none" language. It is not versioned, family is same to itself, and compatible with itself only.
+ * In turn, every {@link Language} implementation must be compatible with {@code NONE} language.
+ */
+ Language NONE = language("none");
+
+ /**
+ * The "resources" language. This is used for files such as images to provide in the output.
+ */
+ Language RESOURCES = language("resources");
+
+ /**
+ * The "script" language. Provided for compatibility with Maven 3.
+ *
+ * @deprecated Use {@link #RESOURCES} instead.
+ */
+ @Deprecated
+ Language SCRIPT = language("script");
+
+ // TODO: this should be moved out from here to Java Support (builtin into core)
+ Language JAVA_FAMILY = language("java");
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Lifecycle.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Lifecycle.java
new file mode 100644
index 000000000000..27cb57d7c480
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Lifecycle.java
@@ -0,0 +1,283 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.model.Plugin;
+
+/**
+ * A Maven lifecycle is a sequence of predefined phases that govern the build process
+ * of a Maven project. Each phase represents a specific step, such as compiling the
+ * code, running tests, packaging the project, and deploying it. Executing a phase
+ * triggers all preceding phases, ensuring that each step of the build process is
+ * completed in the correct order. The three main lifecycles in Maven are
+ * {@link #DEFAULT default}, {@link #CLEAN clean}, and {@link #SITE site}, with the
+ * {@code default} lifecycle being the most commonly used for project builds.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface Lifecycle extends ExtensibleEnum {
+
+ // =========================
+ // Maven defined lifecycles
+ // =========================
+ String CLEAN = "clean";
+ String DEFAULT = "default";
+ String SITE = "site";
+
+ // ======================
+ // Phase qualifiers
+ // ======================
+ String BEFORE = "before:";
+ String AFTER = "after:";
+ String AT = "at:";
+
+ /**
+ * Name or identifier of this lifecycle.
+ *
+ * @return the unique identifier for this lifecycle
+ */
+ @Override
+ String id();
+
+ /**
+ * Collection of main phases for this lifecycle.
+ *
+ * @return the collection of top-level phases in this lifecycle
+ */
+ Collection phases();
+
+ /**
+ * Collection of main phases for this lifecycle used with the Maven 3 builders.
+ * Those builders do not operate on a graph, but on the list and expect a slightly
+ * different ordering (mainly unit test being executed before packaging).
+ *
+ * @return the collection of phases in Maven 3 compatible ordering
+ */
+ default Collection v3phases() {
+ return phases();
+ }
+
+ /**
+ * Stream of phases containing all child phases recursively.
+ *
+ * @return a stream of all phases in this lifecycle, including nested phases
+ */
+ default Stream allPhases() {
+ return phases().stream().flatMap(Phase::allPhases);
+ }
+
+ /**
+ * Collection of aliases for this lifecycle.
+ * Aliases map Maven 3 phase names to their Maven 4 equivalents.
+ *
+ * @return the collection of phase aliases
+ */
+ Collection aliases();
+
+ /**
+ * A phase in the lifecycle.
+ *
+ * A phase is identified by its name. It also contains a list of plugins bound to that phase,
+ * a list of {@link Link links}, and a list of sub-phases. This forms a tree of phases.
+ */
+ interface Phase {
+
+ // ======================
+ // Maven defined phases
+ // ======================
+ String ALL = "all";
+ String EACH = "each";
+ String BUILD = "build";
+ String INITIALIZE = "initialize";
+ String VALIDATE = "validate";
+ String SOURCES = "sources";
+ String RESOURCES = "resources";
+ String COMPILE = "compile";
+ String READY = "ready";
+ String PACKAGE = "package";
+ String VERIFY = "verify";
+ String UNIT_TEST = "unit-test";
+ String TEST_SOURCES = "test-sources";
+ String TEST_RESOURCES = "test-resources";
+ String TEST_COMPILE = "test-compile";
+ String TEST = "test";
+ String INTEGRATION_TEST = "integration-test";
+ String INSTALL = "install";
+ String DEPLOY = "deploy";
+ String CLEAN = "clean";
+
+ /**
+ * Returns the name of this phase.
+ *
+ * @return the phase name
+ */
+ @Nonnull
+ String name();
+
+ /**
+ * Returns the list of plugins bound to this phase.
+ *
+ * @return the list of plugins
+ */
+ @Nonnull
+ List plugins();
+
+ /**
+ * Returns the collection of links from this phase to other phases.
+ *
+ * @return the collection of links
+ */
+ @Nonnull
+ Collection links();
+
+ /**
+ * {@return the list of sub-phases}
+ */
+ @Nonnull
+ List phases();
+
+ /**
+ * Returns a stream of all phases, including this phase and all nested phases.
+ *
+ * @return a stream of all phases
+ */
+ @Nonnull
+ Stream allPhases();
+ }
+
+ /**
+ * A phase alias, mostly used to support the Maven 3 phases which are mapped
+ * to dynamic phases in Maven 4.
+ */
+ interface Alias {
+ /**
+ * Returns the Maven 3 phase name.
+ *
+ * @return the Maven 3 phase name
+ */
+ String v3Phase();
+
+ /**
+ * Returns the Maven 4 phase name.
+ *
+ * @return the Maven 4 phase name
+ */
+ String v4Phase();
+ }
+
+ /**
+ * A link from a phase to another phase, consisting of a type which can be
+ * {@link Kind#BEFORE} or {@link Kind#AFTER}, and a {@link Pointer} to
+ * another phase.
+ */
+ interface Link {
+ enum Kind {
+ BEFORE,
+ AFTER
+ }
+
+ /**
+ * Returns the kind of link (BEFORE or AFTER).
+ *
+ * @return the link kind
+ */
+ Kind kind();
+
+ /**
+ * Returns the pointer to the target phase.
+ *
+ * @return the phase pointer
+ */
+ Pointer pointer();
+ }
+
+ interface Pointer {
+ enum Type {
+ PROJECT,
+ DEPENDENCIES,
+ CHILDREN
+ }
+
+ /**
+ * Returns the name of the target phase.
+ *
+ * @return the phase name
+ */
+ String phase();
+
+ /**
+ * Returns the type of pointer (PROJECT, DEPENDENCIES, or CHILDREN).
+ *
+ * @return the pointer type
+ */
+ Type type();
+ }
+
+ interface PhasePointer extends Pointer {
+ /**
+ * Returns the type of pointer, which is always PROJECT for a PhasePointer.
+ *
+ * @return the PROJECT pointer type
+ */
+ @Override
+ default Type type() {
+ return Type.PROJECT;
+ }
+ }
+
+ interface DependenciesPointer extends Pointer {
+ /**
+ * Returns the dependency scope this pointer applies to.
+ *
+ * @return the dependency scope, or "all" if not specified
+ */
+ String scope(); // default: all
+
+ /**
+ * Returns the type of pointer, which is always DEPENDENCIES for a DependenciesPointer.
+ *
+ * @return the DEPENDENCIES pointer type
+ */
+ @Override
+ default Type type() {
+ return Type.DEPENDENCIES;
+ }
+ }
+
+ interface ChildrenPointer extends Pointer {
+ /**
+ * Returns the type of pointer, which is always CHILDREN for a ChildrenPointer.
+ *
+ * @return the CHILDREN pointer type
+ */
+ @Override
+ default Type type() {
+ return Type.CHILDREN;
+ }
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Listener.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Listener.java
new file mode 100644
index 000000000000..dda744f7375a
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Listener.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Consumer;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * A listener for session events.
+ * TODO: open this to other events like similar to {@code org.apache.maven.eventspy.EventSpy}
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@FunctionalInterface
+@Consumer
+public interface Listener {
+ void onEvent(@Nonnull Event event);
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/LocalRepository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/LocalRepository.java
new file mode 100644
index 000000000000..cea61bc3c504
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/LocalRepository.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.nio.file.Path;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ *
The local repository is a directory on the developer's machine where
+ * Maven stores all the downloaded artifacts (such as dependencies, plugins,
+ * and project artifacts). When Maven builds a project, it first checks the
+ * local repository to see if the required artifacts are already available.
+ * If the artifacts are found locally, Maven uses them directly, which speeds
+ * up the build process by avoiding unnecessary downloads.
+ *
+ *
By default, the local repository is located in the {@code .m2/repository}
+ * directory within the user's home directory ({@code ~/.m2/repository} on
+ * Unix-like systems or {@code C:\Users\YourName\.m2\repository} on Windows).
+ * The location of the local repository can be customized in the
+ * {@code settings.xml} file.
+ *
+ * @since 4.0.0
+ * @see Repository
+ * @see org.apache.maven.api.settings.Settings
+ */
+@Experimental
+@Immutable
+public interface LocalRepository extends Repository {
+
+ @Nonnull
+ Path getPath();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/MojoExecution.java b/api/maven-api-core/src/main/java/org/apache/maven/api/MojoExecution.java
new file mode 100644
index 000000000000..15ffac662fb9
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/MojoExecution.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Optional;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.model.PluginExecution;
+import org.apache.maven.api.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.api.xml.XmlNode;
+
+/**
+ * A {@code MojoExecution} represents a single execution of a Maven Plugin during a given build.
+ * An instance of this object is bound to the {@link org.apache.maven.api.di.MojoExecutionScoped}
+ * and available as {@code mojoExecution} within {@link org.apache.maven.api.plugin.annotations.Parameter}
+ * expressions.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface MojoExecution {
+
+ @Nonnull
+ Plugin getPlugin();
+
+ @Nonnull
+ PluginExecution getModel();
+
+ @Nonnull
+ MojoDescriptor getDescriptor();
+
+ @Nonnull
+ String getExecutionId();
+
+ @Nonnull
+ String getGoal();
+
+ @Nonnull
+ String getLifecyclePhase();
+
+ @Nonnull
+ Optional getConfiguration();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/MonotonicClock.java b/api/maven-api-core/src/main/java/org/apache/maven/api/MonotonicClock.java
new file mode 100644
index 000000000000..963618e59fcb
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/MonotonicClock.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.time.Clock;
+import java.time.Duration;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+
+/**
+ * A Clock implementation that combines monotonic timing with wall-clock time.
+ *
+ * This class provides precise time measurements using {@link System#nanoTime()}
+ * while maintaining wall-clock time information in UTC. The wall-clock time
+ * is computed from the monotonic duration since system start to ensure consistency
+ * between time measurements.
+ *
+ * This implementation is singleton-based and always uses UTC timezone. The clock
+ * cannot be adjusted to different timezones to maintain consistent monotonic behavior.
+ * Users needing local time representation should convert the result of {@link #instant()}
+ * to their desired timezone:
+ *
{@code
+ * Instant now = MonotonicClock.now();
+ * ZonedDateTime local = now.atZone(ZoneId.systemDefault());
+ * }
+ *
+ * @see System#nanoTime()
+ * @see Clock
+ */
+public class MonotonicClock extends Clock {
+ private static final MonotonicClock CLOCK = new MonotonicClock();
+
+ private final long startNanos;
+ private final Instant startInstant;
+
+ /**
+ * Private constructor to enforce singleton pattern.
+ * Initializes the clock with the current system time and nanoTime.
+ */
+ private MonotonicClock() {
+ this.startNanos = System.nanoTime();
+ this.startInstant = Clock.systemUTC().instant();
+ }
+
+ /**
+ * Returns the singleton instance of MonotonicClock.
+ *
+ * @return the monotonic clock instance
+ */
+ public static MonotonicClock get() {
+ return CLOCK;
+ }
+
+ /**
+ * Returns the current instant from the monotonic clock.
+ * This is a convenience method equivalent to {@code get().instant()}.
+ *
+ * @return the current instant using monotonic timing
+ */
+ public static Instant now() {
+ return get().instant();
+ }
+
+ /**
+ * Returns the initialization time of this monotonic clock.
+ * This is a convenience method equivalent to {@code get().start()}.
+ *
+ * @return the instant when this monotonic clock was initialized
+ * @see #startInstant()
+ */
+ public static Instant start() {
+ return get().startInstant();
+ }
+
+ /**
+ * Returns the elapsed time since clock initialization.
+ * This is a convenience method equivalent to {@code get().elapsedTime()}.
+ *
+ * @return the duration since clock initialization
+ */
+ public static Duration elapsed() {
+ return get().elapsedTime();
+ }
+
+ /**
+ * Returns a monotonically increasing instant.
+ *
+ * The returned instant is calculated by adding the elapsed nanoseconds
+ * since clock creation to the initial wall clock time. This ensures that
+ * the time never goes backwards and maintains a consistent relationship
+ * with the wall clock time.
+ *
+ * @return the current instant using monotonic timing
+ */
+ @Override
+ public Instant instant() {
+ long elapsedNanos = System.nanoTime() - startNanos;
+ return startInstant.plusNanos(elapsedNanos);
+ }
+
+ /**
+ * Returns the wall clock time captured when this monotonic clock was initialized.
+ *
+ * This instant serves as the base time from which all subsequent {@link #instant()}
+ * calls are calculated by adding the elapsed monotonic duration. This ensures
+ * consistency between the monotonic measurements and wall clock time.
+ *
+ * @return the initial wall clock instant when this clock was created
+ * @see #instant()
+ */
+ public Instant startInstant() {
+ return startInstant;
+ }
+
+ /**
+ * Returns the duration elapsed since this clock was initialized.
+ *
+ * The returned duration is calculated using {@link System#nanoTime()}
+ * to ensure monotonic behavior. This duration represents the exact time
+ * span between clock initialization and the current instant.
+ *
+ * @return the duration since clock initialization
+ * @see #startInstant()
+ * @see #instant()
+ */
+ public Duration elapsedTime() {
+ long elapsedNanos = System.nanoTime() - startNanos;
+ return Duration.ofNanos(elapsedNanos);
+ }
+
+ /**
+ * Returns the zone ID of this clock, which is always UTC.
+ *
+ * @return the UTC zone ID
+ */
+ @Override
+ public ZoneId getZone() {
+ return ZoneOffset.UTC;
+ }
+
+ /**
+ * Returns this clock since timezone adjustments are not supported.
+ *
+ * This implementation maintains UTC time to ensure monotonic behavior.
+ * The provided zone parameter is ignored.
+ *
+ * @param zone the target timezone (ignored)
+ * @return this clock instance
+ */
+ @Override
+ public Clock withZone(ZoneId zone) {
+ // Monotonic clock is always UTC-based
+ return this;
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java
new file mode 100644
index 000000000000..ba0e5f108efa
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+import org.apache.maven.api.annotations.Provider;
+
+/**
+ * Represents a dependency node within a Maven project's dependency collector.
+ *
+ * @since 4.0.0
+ * @see org.apache.maven.api.services.DependencyResolverResult#getRoot()
+ */
+@Experimental
+@Immutable
+@Provider
+public interface Node {
+
+ /**
+ * @return artifact for this node
+ */
+ @Nullable
+ Artifact getArtifact();
+
+ /**
+ * @return dependency for this node
+ */
+ @Nullable
+ Dependency getDependency();
+
+ /**
+ * Gets the child nodes of this node.
+ *
+ * @return the child nodes of this node, never {@code null}
+ */
+ @Nonnull
+ List getChildren();
+
+ /**
+ * @return repositories of this node
+ */
+ @Nonnull
+ List getRemoteRepositories();
+
+ /**
+ * The repository where this artifact has been downloaded from.
+ */
+ @Nonnull
+ Optional getRepository();
+
+ /**
+ * Traverses this node and potentially its children using the specified visitor.
+ *
+ * @param visitor the visitor to call back, must not be {@code null}
+ * @return {@code true} to visit siblings nodes of this node as well, {@code false} to skip siblings
+ */
+ boolean accept(@Nonnull NodeVisitor visitor);
+
+ /**
+ * Returns a new tree starting at this node, filtering the children.
+ * Note that this node will not be filtered and only the children
+ * and its descendant will be checked.
+ *
+ * @param filter the filter to apply
+ * @return a new filtered graph
+ */
+ @Nonnull
+ Node filter(@Nonnull Predicate filter);
+
+ /**
+ * Returns a detailed string representation of this dependency node.
+ *
+ * When verbose mode is disabled, returns the basic string representation in the format:
+ * {@code groupId:artifactId:version[:scope]}
+ *
+ * When verbose mode is enabled, additional details are included with the following format:
+ *
+ *
For included dependencies: {@code groupId:artifactId:version[:scope] (details)}
+ *
For omitted dependencies: {@code (groupId:artifactId:version[:scope] - details)}
+ *
+ * Where details may include:
+ *
+ *
Version management information (if the version was managed from a different version)
+ *
Scope management information (if the scope was managed from a different scope)
+ *
Scope updates (if the scope was changed during resolution)
+ *
Conflict resolution information (if the dependency was omitted due to conflicts or duplicates)
+ *
+ *
+ * @return a string representation of this dependency node with optional detailed information
+ */
+ @Nonnull
+ String asString();
+
+ /**
+ * Obtain a Stream containing this node and all its descendants.
+ *
+ * @return a stream containing this node and its descendants
+ */
+ @Nonnull
+ default Stream stream() {
+ return Stream.concat(Stream.of(this), getChildren().stream().flatMap(Node::stream));
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/NodeVisitor.java b/api/maven-api-core/src/main/java/org/apache/maven/api/NodeVisitor.java
new file mode 100644
index 000000000000..a09fc95f5ee5
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/NodeVisitor.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Consumer;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Defines a hierarchical visitor for collecting dependency node trees.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Consumer
+public interface NodeVisitor {
+ /**
+ * Starts the visit to the specified dependency node.
+ *
+ * @param node the dependency node to visit
+ * @return true to visit the specified dependency node's children, false to skip the
+ * specified dependency node's children and proceed to its next sibling
+ */
+ boolean enter(@Nonnull Node node);
+
+ /**
+ * Ends the visit to the specified dependency node.
+ *
+ * @param node the dependency node to visit
+ * @return true to visit the specified dependency node's next sibling, false to skip the
+ * specified dependency node's next siblings and proceed to its parent
+ */
+ boolean leave(@Nonnull Node node);
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Packaging.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Packaging.java
new file mode 100644
index 000000000000..18437f9c7773
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Packaging.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Map;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.model.PluginContainer;
+
+/**
+ * Represents the packaging of a Maven project.
+ *
+ *
The {@code Packaging} class defines the type of artifact that a Maven project produces during the build process.
+ * The packaging type determines the structure of the project's output and how Maven will treat the resulting artifact.
+ *
+ *
Common packaging types include {@code jar}, {@code war}, {@code pom}, {@code maven-plugin}, {@code ear}, and others.
+ * These types influence various aspects of the build lifecycle, such as which plugins are executed and how dependencies are managed.
+ *
+ *
The {@code Packaging} class is an immutable value object, ensuring that once a packaging type is defined, it cannot be changed.
+ *
+ *
Standard Packaging Types
+ *
+ *
{@code jar}: Packages the project as a Java Archive (JAR) file.
+ *
{@code war}: Packages the project as a Web Application Archive (WAR) file.
+ *
{@code pom}: Indicates that the project does not produce a deployable artifact but is used for dependency management or as an aggregator.
+ *
{@code maven-plugin}: Packages the project as a Maven plugin.
+ *
+ * @see org.apache.maven.api.Session#requirePackaging(String)
+ * @see org.apache.maven.api.Project#getPackaging()
+ * @see org.apache.maven.api.model.Model#getPackaging()
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface Packaging extends ExtensibleEnum {
+ /**
+ * The packaging id.
+ */
+ @Nonnull
+ @Override
+ String id();
+
+ /**
+ * The language of this packaging.
+ */
+ @Nonnull
+ default Language language() {
+ return type().getLanguage();
+ }
+
+ /**
+ * The type of main artifact produced by this packaging.
+ */
+ @Nonnull
+ Type type();
+
+ /**
+ * Returns the binding to use specifically for this packaging keyed by lifecycle id.
+ * This will be used instead of the default packaging definition.
+ */
+ @Nonnull
+ Map plugins();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/PathScope.java b/api/maven-api-core/src/main/java/org/apache/maven/api/PathScope.java
new file mode 100644
index 000000000000..bd8a6f1bf51c
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/PathScope.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Set;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+import static org.apache.maven.api.ExtensibleEnums.pathScope;
+
+/**
+ * Path scope.
+ * A path scope is used to determine the kind of build or class path that will be built when resolving
+ * dependencies using the {@link org.apache.maven.api.services.DependencyResolver} service.
+ *
+ * This extensible enum has four defined values, {@link #MAIN_COMPILE}, {@link #MAIN_RUNTIME},
+ * {@link #TEST_COMPILE} and {@link #TEST_RUNTIME}, but can be extended by registering a
+ * {@code org.apache.maven.api.spi.PathScopeProvider}.
+ *
+ * Implementation must have {@code equals()} and {@code hashCode()} implemented, so implementations of this interface
+ * can be used as keys.
+ *
+ * @since 4.0.0
+ * @see org.apache.maven.api.services.DependencyResolver
+ * @see DependencyScope
+ */
+@Experimental
+@Immutable
+public interface PathScope extends ExtensibleEnum {
+
+ // TODO: what if I simply want all dependencies ?
+ @Nonnull
+ ProjectScope projectScope();
+
+ @Nonnull
+ Set dependencyScopes();
+
+ PathScope MAIN_COMPILE = pathScope(
+ "main-compile",
+ ProjectScope.MAIN,
+ DependencyScope.COMPILE_ONLY,
+ DependencyScope.COMPILE,
+ DependencyScope.PROVIDED);
+
+ PathScope MAIN_RUNTIME =
+ pathScope("main-runtime", ProjectScope.MAIN, DependencyScope.COMPILE, DependencyScope.RUNTIME);
+
+ PathScope TEST_COMPILE = pathScope(
+ "test-compile",
+ ProjectScope.TEST,
+ DependencyScope.COMPILE,
+ DependencyScope.PROVIDED,
+ DependencyScope.TEST_ONLY,
+ DependencyScope.TEST);
+
+ PathScope TEST_RUNTIME = pathScope(
+ "test-runtime",
+ ProjectScope.TEST,
+ DependencyScope.COMPILE,
+ DependencyScope.RUNTIME,
+ DependencyScope.PROVIDED,
+ DependencyScope.TEST,
+ DependencyScope.TEST_RUNTIME);
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/PathType.java b/api/maven-api-core/src/main/java/org/apache/maven/api/PathType.java
new file mode 100644
index 000000000000..5c2e302dca83
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/PathType.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.nio.file.Path;
+import java.util.Optional;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * The option of a command-line tool where to place the paths to some dependencies.
+ * A {@code PathType} can identify the Java class-path, the Java module path,
+ * or another kind of path for another programming language for example.
+ * Path types are often exclusive. For example, a dependency should not be
+ * both on the Java class path and on the Java module path.
+ *
+ * @see org.apache.maven.api.services.DependencyResolverResult#getDispatchedPaths()
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface PathType {
+ /**
+ * The type for all paths that could not be placed in any of the types requested by a caller.
+ * This type can appear in the return value of a call to
+ * {@link Session#resolveDependencies resolveDependencies(...)} when at least one dependency
+ * cannot be associated to any type specified in the {@code desiredTypes} argument.
+ * Plugins can choose to report a warning to users when unresolved paths exist.
+ */
+ PathType UNRESOLVED = new PathType() {
+ @Override
+ public String name() {
+ return "UNRESOLVED";
+ }
+
+ @Override
+ public String id() {
+ return "UNRESOLVED";
+ }
+
+ @Override
+ public Optional option() {
+ return Optional.empty();
+ }
+
+ @Override
+ public String[] option(Iterable extends Path> paths) {
+ return new String[0];
+ }
+ };
+
+ /**
+ * Returns the unique name of this path type, including the module to patch if any.
+ * For example, if this type is {@link JavaPathType#MODULES}, then this method returns {@code "MODULES"}.
+ * But if this type was created by {@code JavaPathType.patchModule("foo.bar")}, then this method returns
+ * {@code "PATCH_MODULE:foo.bar"}.
+ *
+ * @return the programmatic name together with the module name on which it applies
+ * @see #toString()
+ */
+ @Nonnull
+ String id();
+
+ /**
+ * Returns the name of the tool option for this path. For example, if this path type
+ * is {@link JavaPathType#MODULES}, then this method returns {@code "--module-path"}.
+ * The option does not include the {@linkplain JavaPathType.Modular#moduleName() module name}
+ * on which it applies.
+ *
+ * @return the name of the tool option for this path type
+ */
+ @Nonnull
+ Optional option();
+
+ /**
+ * Returns the option followed by a string representation of the given path elements.
+ * The path elements are separated by an option-specific or platform-specific separator.
+ * If the given {@code paths} argument contains no element, then this method returns an empty string.
+ *
+ *
Examples
+ * If {@code paths} is a list containing two elements, {@code dir/path1} and {@code dir/path2}, then:
+ *
+ *
+ *
If this type is {@link JavaPathType#MODULES}, then this method returns
+ * {@code {"--module-path", "dir/path1:dir/path2"}} on Unix or
+ * {@code {"--module-path", "dir\path1;dir\path2"}} on Windows.
+ *
If this type was created by {@code JavaPathType.patchModule("foo.bar")}, then the method returns
+ * {@code {"--patch-module", "foo.bar=dir/path1:dir/path2"}} on Unix or
+ * {@code {"--patch-module", "foo.bar=dir\path1;dir\path2"}} on Windows.
+ *
+ *
+ * @param paths the path to format as a string
+ * @return the option associated to this path type followed by the given path elements,
+ * or an empty array if there is no path element.
+ */
+ @Nonnull
+ String[] option(Iterable extends Path> paths);
+
+ /**
+ * Returns the name of this path type. For example, if this path type
+ * is {@link JavaPathType#MODULES}, then this method returns {@code "MODULES"}.
+ *
+ * @return the programmatic name of this path type
+ */
+ @Nonnull
+ String name();
+
+ /**
+ * {@return a string representation for this extensible enum describing a path type}
+ * For example {@code "PathType[PATCH_MODULE:foo.bar]"}.
+ */
+ @Nonnull
+ @Override
+ String toString();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Plugin.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Plugin.java
new file mode 100644
index 000000000000..df26c2b8e9d0
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Plugin.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.api.plugin.descriptor.lifecycle.Lifecycle;
+
+/**
+ * Represents a maven plugin runtime
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface Plugin {
+
+ @Nonnull
+ org.apache.maven.api.model.Plugin getModel();
+
+ @Nonnull
+ PluginDescriptor getDescriptor();
+
+ @Nonnull
+ List getLifecycles();
+
+ @Nonnull
+ ClassLoader getClassLoader();
+
+ @Nonnull
+ Artifact getArtifact();
+
+ @Nonnull
+ default Collection getDependencies() {
+ return getDependenciesMap().values();
+ }
+
+ @Nonnull
+ Map getDependenciesMap();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/ProducedArtifact.java b/api/maven-api-core/src/main/java/org/apache/maven/api/ProducedArtifact.java
new file mode 100644
index 000000000000..6c9e1be33c45
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/ProducedArtifact.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.nio.file.Path;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+
+/**
+ * An {@link Artifact} that is being produced by a {@link Project} during the build.
+ *
+ *
Produced artifacts includes:
+ *
{@linkplain Project#getPomArtifact() the project POM artifact}
+ *
{@linkplain Project#getMainArtifact() the main artifact}
+ *
{@linkplain org.apache.maven.api.services.ProjectManager#attachArtifact(Session, Project, Path) artifacts to be attached to a project}
+ *
+ *
+ *
For the main artifact and attached artifacts, the
+ * {@link org.apache.maven.api.services.ArtifactManager ArtifactManager} service must be used
+ * to point the artifact to a {@link Path} during the packaging phase.
+ *
+ * @since 4.0.0
+ * @see Project#getMainArtifact()
+ * @see Project#getPomArtifact()
+ * @see org.apache.maven.api.services.ProjectManager#attachArtifact(Session, Project, Path)
+ * @see org.apache.maven.api.services.ArtifactManager#setPath(ProducedArtifact, Path)
+ */
+@Experimental
+@Immutable
+public interface ProducedArtifact extends Artifact {}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Project.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Project.java
new file mode 100644
index 000000000000..8e989ad4ae98
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Project.java
@@ -0,0 +1,306 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.nio.file.Path;
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.model.Build;
+import org.apache.maven.api.model.Model;
+import org.apache.maven.api.model.Profile;
+
+/**
+ * Interface representing a Maven project which can be created using the
+ * {@link org.apache.maven.api.services.ProjectBuilder ProjectBuilder} service.
+ * Such objects are immutable and plugin that wish to modify such objects
+ * need to do so using the {@link org.apache.maven.api.services.ProjectManager
+ * ProjectManager} service.
+ *
+ * Projects are created using the {@code ProjectBuilder} from a POM file
+ * (usually named {@code pom.xml}) on the file system.
+ * The {@link #getPomPath()} will point to the POM file and the
+ * {@link #getBasedir()} to the directory parent containing the
+ * POM file.
+ *
+ * Note: unlike in legacy code, logical checks against string representing packaging (returned by this method)
+ * are NOT recommended (code like {@code "pom".equals(project.getPackaging)} must be avoided). Use method
+ * {@link #getArtifacts()} to gain access to POM or build artifact.
+ *
+ * @see #getArtifacts()
+ */
+ @Nonnull
+ Packaging getPackaging();
+
+ /**
+ * {@return the project language}. It is by default determined by {@link #getPackaging()}.
+ *
+ * @see #getPackaging()
+ */
+ @Nonnull
+ default Language getLanguage() {
+ return getPackaging().language();
+ }
+
+ /**
+ * {@return the project POM artifact}, which is the artifact of the POM of this project. Every project have a POM
+ * artifact, even if the existence of backing POM file is NOT a requirement (i.e. for some transient projects).
+ *
+ * @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
+ */
+ @Nonnull
+ default ProducedArtifact getPomArtifact() {
+ return getArtifacts().get(0);
+ }
+
+ /**
+ * {@return the project main artifact}, which is the artifact produced by this project build, if applicable.
+ * This artifact MAY be absent if the project is actually not producing any main artifact (i.e. "pom" packaging).
+ *
+ * @see #getPackaging()
+ * @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
+ */
+ @Nonnull
+ default Optional getMainArtifact() {
+ List artifacts = getArtifacts();
+ return artifacts.size() == 2 ? Optional.of(artifacts.get(1)) : Optional.empty();
+ }
+
+ /**
+ * {@return the project artifacts as immutable list}. Elements are the project POM artifact and the artifact
+ * produced by this project build, if applicable. Hence, the returned list may have one or two elements
+ * (never less than 1, never more than 2), depending on project packaging.
+ *
+ * The list's first element is ALWAYS the project POM artifact. Presence of second element in the list depends
+ * solely on the project packaging.
+ *
+ * @see #getPackaging()
+ * @see #getPomArtifact()
+ * @see #getMainArtifact()
+ * @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
+ */
+ @Nonnull
+ List getArtifacts();
+
+ /**
+ * {@return the project model}.
+ */
+ @Nonnull
+ Model getModel();
+
+ /**
+ * Shorthand method.
+ *
+ * @return the build element of the project model
+ */
+ @Nonnull
+ default Build getBuild() {
+ Build build = getModel().getBuild();
+ return build != null ? build : Build.newInstance();
+ }
+
+ /**
+ * Returns the path to the pom file for this project.
+ * A project is usually read from a file named {@code pom.xml},
+ * which contains the {@linkplain #getModel() model} in an XML form.
+ * When a custom {@code org.apache.maven.api.spi.ModelParser} is used,
+ * the path may point to a non XML file.
+ *
+ * The POM path is also used to define the {@linkplain #getBasedir() base directory}
+ * of the project.
+ *
+ * @return the path of the pom
+ * @see #getBasedir()
+ */
+ @Nonnull
+ Path getPomPath();
+
+ /**
+ * Returns the project base directory, i.e. the directory containing the project.
+ * A project is usually read from the file system and this will point to
+ * the directory containing the POM file.
+ *
+ * @return the path of the directory containing the project
+ */
+ @Nonnull
+ Path getBasedir();
+
+ /**
+ * {@return the project direct dependencies (directly specified or inherited)}.
+ */
+ @Nonnull
+ List getDependencies();
+
+ /**
+ * {@return the project managed dependencies (directly specified or inherited)}.
+ */
+ @Nonnull
+ List getManagedDependencies();
+
+ /**
+ * {@return the project ID, usable as key}.
+ */
+ @Nonnull
+ default String getId() {
+ return getModel().getId();
+ }
+
+ /**
+ * Returns a boolean indicating if the project is the top level project for
+ * this reactor build. The top level project may be different from the
+ * {@code rootDirectory}, especially if a subtree of the project is being
+ * built, either because Maven has been launched in a subdirectory or using
+ * a {@code -f} option.
+ *
+ * @return {@code true} if the project is the top level project for this build
+ */
+ boolean isTopProject();
+
+ /**
+ * Returns a boolean indicating if the project is a root project,
+ * meaning that the {@link #getRootDirectory()} and {@link #getBasedir()}
+ * points to the same directory, and that either {@link Model#isRoot()}
+ * is {@code true} or that {@code basedir} contains a {@code .mvn} child
+ * directory.
+ *
+ * @return {@code true} if the project is the root project
+ * @see Model#isRoot()
+ */
+ boolean isRootProject();
+
+ /**
+ * Gets the root directory of the project, which is the parent directory
+ * containing the {@code .mvn} directory or flagged with {@code root="true"}.
+ *
+ * @return the root directory of the project
+ * @throws IllegalStateException if the root directory could not be found
+ * @see Session#getRootDirectory()
+ */
+ @Nonnull
+ Path getRootDirectory();
+
+ /**
+ * Returns project parent project, if any.
+ *
+ * Note that the model may have a parent defined, but an empty parent
+ * project may be returned if the parent comes from a remote repository,
+ * as a {@code Project} must refer to a buildable project.
+ *
+ * @return an optional containing the parent project
+ * @see Model#getParent()
+ */
+ @Nonnull
+ Optional getParent();
+
+ /**
+ * Returns all profiles defined in this project.
+ *
+ * This method returns only the profiles defined directly in the current project's POM
+ * and does not include profiles from parent projects.
+ *
+ * @return a non-null, possibly empty list of profiles defined in this project
+ * @see Profile
+ * @see #getEffectiveProfiles()
+ */
+ @Nonnull
+ List getDeclaredProfiles();
+
+ /**
+ * Returns all profiles defined in this project and all of its parent projects.
+ *
+ * This method traverses the parent hierarchy and includes profiles defined in parent POMs.
+ * The returned list contains profiles from the current project and all of its ancestors in
+ * the project inheritance chain.
+ *
+ * @return a non-null, possibly empty list of all profiles from this project and its parents
+ * @see Profile
+ * @see #getDeclaredProfiles()
+ */
+ @Nonnull
+ List getEffectiveProfiles();
+
+ /**
+ * Returns all active profiles for the current project build.
+ *
+ * Active profiles are those that have been explicitly activated through one of the following means:
+ *
+ *
Command line activation using the -P flag
+ *
Maven settings activation in settings.xml via <activeProfiles>
+ *
Automatic activation via <activation> conditions
+ *
The default active profile (marked with <activeByDefault>true</activeByDefault>)
+ *
+ *
+ * The active profiles control various aspects of the build configuration including but not
+ * limited to dependencies, plugins, properties, and build resources.
+ *
+ * @return a non-null, possibly empty list of active profiles for this project
+ * @see Profile
+ * @see #getEffectiveActiveProfiles()
+ */
+ @Nonnull
+ List getDeclaredActiveProfiles();
+
+ /**
+ * Returns all active profiles for this project and all of its parent projects.
+ *
+ * This method traverses the parent hierarchy and collects all active profiles from
+ * the current project and its ancestors. Active profiles are those that meet the
+ * activation criteria through explicit activation or automatic conditions.
+ *
+ * The combined set of active profiles from the entire project hierarchy affects
+ * the effective build configuration.
+ *
+ * @return a non-null, possibly empty list of all active profiles from this project and its parents
+ * @see Profile
+ * @see #getDeclaredActiveProfiles()
+ */
+ @Nonnull
+ List getEffectiveActiveProfiles();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/ProjectScope.java b/api/maven-api-core/src/main/java/org/apache/maven/api/ProjectScope.java
new file mode 100644
index 000000000000..1a4cd3da0873
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/ProjectScope.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+
+import static org.apache.maven.api.ExtensibleEnums.projectScope;
+
+/**
+ * Project scope.
+ * Defines the type of source files to compile, usually either the one that compose the output package
+ * (i.e. the main artifact) or the ones that will be used when building tests).
+ *
+ * This extensible enum has two defined values, {@link #MAIN} and {@link #TEST},
+ * but can be extended by registering a {@code org.apache.maven.api.spi.ProjectScopeProvider}.
+ *
+ * Implementation must have {@code equals()} and {@code hashCode()} implemented, so implementations of this interface
+ * can be used as keys.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+@SuppressWarnings("checkstyle:InterfaceIsType")
+public interface ProjectScope extends ExtensibleEnum {
+
+ /**
+ * Main scope.
+ */
+ ProjectScope MAIN = projectScope("main");
+
+ /**
+ * Test scope.
+ */
+ ProjectScope TEST = projectScope("test");
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/ProtoSession.java b/api/maven-api-core/src/main/java/org/apache/maven/api/ProtoSession.java
new file mode 100644
index 000000000000..41300d074e63
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/ProtoSession.java
@@ -0,0 +1,227 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.nio.file.Path;
+import java.time.Instant;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+import org.apache.maven.api.annotations.ThreadSafe;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * The proto session, material used to create {@link Session}.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@ThreadSafe
+public interface ProtoSession {
+
+ /**
+ * Returns immutable user properties to use for interpolation. The user properties have been configured directly
+ * by the user, e.g. via the {@code -Dkey=value} parameter on the command line.
+ *
+ * @return the user properties, never {@code null}
+ */
+ @Nonnull
+ Map getUserProperties();
+
+ /**
+ * Returns immutable system properties to use for interpolation. The system properties are collected from the
+ * runtime environment such as {@link System#getProperties()} and environment variables
+ * (prefixed with {@code env.}).
+ *
+ * @return the system properties, never {@code null}
+ */
+ @Nonnull
+ Map getSystemProperties();
+
+ /**
+ * Returns the properly overlaid map of properties: system + user.
+ */
+ @Nonnull
+ Map getEffectiveProperties();
+
+ /**
+ * Returns the start time of the session.
+ *
+ * @return the start time as an Instant object, never {@code null}
+ */
+ @Nonnull
+ Instant getStartTime();
+
+ /**
+ * Gets the directory of the topmost project being built, usually the current directory or the
+ * directory pointed at by the {@code -f/--file} command line argument.
+ *
+ * @return the directory of the topmost project, never {@code null}
+ * @see Project#isTopProject()
+ * @see #getRootDirectory()
+ */
+ @Nonnull
+ Path getTopDirectory();
+
+ /**
+ * Gets the root directory of the session, which is the root directory for the top directory project.
+ *
+ * @return the root directory, never {@code null}
+ * @throws IllegalStateException if the root directory could not be found
+ * @see #getTopDirectory()
+ * @see Project#getRootDirectory()
+ * @see Project#isRootProject()
+ */
+ @Nonnull
+ Path getRootDirectory();
+
+ /**
+ * Returns a proto session builder of this instance.
+ */
+ @Nonnull
+ default Builder toBuilder() {
+ try {
+ return new Builder(
+ getUserProperties(), getSystemProperties(), getStartTime(), getTopDirectory(), getRootDirectory());
+ } catch (IllegalStateException e) {
+ return new Builder(getUserProperties(), getSystemProperties(), getStartTime(), getTopDirectory(), null);
+ }
+ }
+
+ /**
+ * Returns new builder from scratch.
+ */
+ static Builder newBuilder() {
+ return new Builder().withStartTime(MonotonicClock.now());
+ }
+
+ class Builder {
+ private Map userProperties;
+ private Map systemProperties;
+ private Instant startTime;
+ private Path topDirectory;
+ private Path rootDirectory;
+
+ private Builder() {}
+
+ private Builder(
+ Map userProperties,
+ Map systemProperties,
+ Instant startTime,
+ Path topDirectory,
+ Path rootDirectory) {
+ this.userProperties = userProperties;
+ this.systemProperties = systemProperties;
+ this.startTime = startTime;
+ this.topDirectory = topDirectory;
+ this.rootDirectory = rootDirectory;
+ }
+
+ public Builder withUserProperties(@Nonnull Map userProperties) {
+ this.userProperties = new HashMap<>(userProperties);
+ return this;
+ }
+
+ public Builder withSystemProperties(@Nonnull Map systemProperties) {
+ this.systemProperties = new HashMap<>(systemProperties);
+ return this;
+ }
+
+ public Builder withStartTime(@Nonnull Instant startTime) {
+ this.startTime = requireNonNull(startTime, "startTime");
+ return this;
+ }
+
+ public Builder withTopDirectory(@Nonnull Path topDirectory) {
+ this.topDirectory = requireNonNull(topDirectory, "topDirectory");
+ return this;
+ }
+
+ public Builder withRootDirectory(@Nullable Path rootDirectory) {
+ this.rootDirectory = rootDirectory;
+ return this;
+ }
+
+ public ProtoSession build() {
+ return new Impl(userProperties, systemProperties, startTime, topDirectory, rootDirectory);
+ }
+
+ private static class Impl implements ProtoSession {
+ private final Map userProperties;
+ private final Map systemProperties;
+ private final Map effectiveProperties;
+ private final Instant startTime;
+ private final Path topDirectory;
+ private final Path rootDirectory;
+
+ private Impl(
+ Map userProperties,
+ Map systemProperties,
+ Instant startTime,
+ Path topDirectory,
+ Path rootDirectory) {
+ this.userProperties = Map.copyOf(userProperties);
+ this.systemProperties = Map.copyOf(systemProperties);
+ Map cp = new HashMap<>(systemProperties);
+ cp.putAll(userProperties);
+ this.effectiveProperties = Map.copyOf(cp);
+ this.startTime = requireNonNull(startTime);
+ this.topDirectory = requireNonNull(topDirectory);
+ this.rootDirectory = rootDirectory;
+ }
+
+ @Override
+ public Map getUserProperties() {
+ return userProperties;
+ }
+
+ @Override
+ public Map getSystemProperties() {
+ return systemProperties;
+ }
+
+ @Override
+ public Map getEffectiveProperties() {
+ return effectiveProperties;
+ }
+
+ @Override
+ public Instant getStartTime() {
+ return startTime;
+ }
+
+ @Override
+ public Path getTopDirectory() {
+ return topDirectory;
+ }
+
+ @Override
+ public Path getRootDirectory() {
+ if (rootDirectory == null) {
+ throw new IllegalStateException("root directory not set");
+ }
+ return rootDirectory;
+ }
+ }
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/RemoteRepository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/RemoteRepository.java
new file mode 100644
index 000000000000..a2fea88a19a8
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/RemoteRepository.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.model.ModelBase;
+
+/**
+ *
A remote repository is a central or distributed location
+ * from which Maven can download project dependencies, plugins, and other
+ * build artifacts. When Maven cannot find an artifact in the local
+ * repository, it attempts to retrieve it from one or more remote
+ * repositories.
+ *
+ *
There are several types of remote repositories:
+ *
Central Repository: The default remote repository used by Maven. It is a large, publicly accessible repository maintained by the Maven community at https://repo.maven.apache.org/maven2. Most common Java libraries and frameworks are hosted here.
+ *
Private Remote Repository: Organizations often maintain their own private remote repositories, which may host proprietary or custom-built artifacts that are not available in the central repository. These repositories can be managed using tools like Apache Archiva, Sonatype Nexus, or JFrog Artifactory.
+ *
Third-Party Repositories: Some projects or organizations host their own remote repositories for distributing specific artifacts that are not available in the central repository. These repositories must be explicitly added to the Maven pom.xml or settings.xml files for Maven to access them.
+ *
+ *
Repository Configuration
+ *
+ *
Repositories can be configured at various levels:
+ *
POM: Repositories can be specified in the {@code pom.xml} file under the {@code } and {@code } sections.
+ *
Settings: the {@code settings.xml} can be used to provide additional repositories in the three level of settings (user, project, installation).
+ *
+ *
By understanding and properly configuring repositories, developers can control where Maven looks for dependencies, manage access to proprietary artifacts, and optimize the build process to ensure consistency and reliability across projects.
+ *
+ *
+ *
+ * @since 4.0.0
+ * @see Repository
+ * @see LocalRepository
+ * @see Session#getSettings()
+ * @see ModelBase#getRepositories()
+ * @see ModelBase#getPluginRepositories()
+ */
+@Experimental
+@Immutable
+public interface RemoteRepository extends Repository {
+
+ @Nonnull
+ String getUrl();
+
+ @Nonnull
+ String getProtocol();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java
new file mode 100644
index 000000000000..82c5a1b1c4ff
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ *
In Maven, repositories are locations where project artifacts (such as JAR files, POM files, and other
+ * resources) are stored and retrieved. There are two primary types of repositories:
+ * {@linkplain LocalRepository local repositories} and
+ * {@linkplain RemoteRepository remote repositories}.
+ *
+ *
Repository Resolution Process
+ *
+ *
When resolving dependencies, Maven follows this order:
+ *
Check Local Repository: Maven first checks if the artifact is available in the local repository.
+ *
Check Remote Repositories: If the artifact is not found locally, Maven queries the configured remote repositories in the order they are listed.
+ *
Download and Cache: If Maven finds the artifact in a remote repository, it downloads it and stores it in the local repository for future use.
+ *
+ *
By caching artifacts in the local repository, Maven minimizes the need to repeatedly download the same artifacts, thus optimizing the build process.
+ *
+ *
Repository Configuration
+ *
+ *
Repositories can be configured at various levels:
+ *
POM: Repositories can be specified in the {@code pom.xml} file under the {@code } and {@code } sections.
+ *
Settings: the {@code settings.xml} can be used to provide additional repositories in the three level of settings (user, project, installation).
+ *
+ * By understanding and properly configuring repositories, developers can control where Maven looks for dependencies, manage access to proprietary artifacts, and optimize the build process to ensure consistency and reliability across projects.
+ *
+ * @since 4.0.0
+ * @see RemoteRepository
+ * @see LocalRepository
+ */
+@Experimental
+@Immutable
+public interface Repository {
+
+ /**
+ * The reserved id for Maven Central
+ */
+ String CENTRAL_ID = "central";
+
+ /**
+ * Gets the identifier of this repository.
+ *
+ * @return the (case-sensitive) identifier, never {@code null}
+ */
+ @Nonnull
+ String getId();
+
+ /**
+ * Gets the type of the repository, for example "default".
+ *
+ * @return the (case-sensitive) type of the repository, never {@code null}
+ */
+ @Nonnull
+ String getType();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Service.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Service.java
new file mode 100644
index 000000000000..d39bdc6766d3
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Service.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.ThreadSafe;
+
+/**
+ * Marker interface for all services provided by the {@link Session}.
+ *
+ * Services can be retrieved from the session using the
+ * {@link Session#getService(Class)} method.
+ *
+ * @since 4.0.0
+ * @see Session#getService(Class)
+ */
+@Experimental
+@ThreadSafe
+public interface Service {}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java
new file mode 100644
index 000000000000..8ef3802062ea
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java
@@ -0,0 +1,865 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.nio.file.Path;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Optional;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+import org.apache.maven.api.annotations.ThreadSafe;
+import org.apache.maven.api.model.Repository;
+import org.apache.maven.api.services.ArtifactCoordinatesFactory;
+import org.apache.maven.api.services.DependencyCoordinatesFactory;
+import org.apache.maven.api.services.VersionResolverException;
+import org.apache.maven.api.settings.Settings;
+import org.apache.maven.api.toolchain.ToolchainModel;
+
+/**
+ * The session to install / deploy / resolve artifacts and dependencies.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@ThreadSafe
+public interface Session extends ProtoSession {
+
+ /**
+ * Returns the current maven version.
+ *
+ * @return the maven version, never {@code null}
+ */
+ @Nonnull
+ Version getMavenVersion();
+
+ /**
+ * Retrieves the settings for the current session.
+ *
+ * @return the settings instance
+ */
+ @Nonnull
+ Settings getSettings();
+
+ /**
+ * Retrieves toolchain models that have been explicitly configured.
+ *
+ * @return the toolchain models
+ */
+ @Nonnull
+ Collection getToolchains();
+
+ /**
+ * Retrieves the local repository associated with this session.
+ *
+ * @return the local repository instance
+ */
+ @Nonnull
+ LocalRepository getLocalRepository();
+
+ /**
+ * Retrieves a list of remote repositories associated with this session.
+ *
+ * @return a list of remote repositories
+ */
+ @Nonnull
+ List getRemoteRepositories();
+
+ /**
+ * Retrieves the session data associated with this session.
+ *
+ * @return the session data, never {@code null}
+ */
+ @Nonnull
+ SessionData getData();
+
+ /**
+ * Default implementation at {@link ProtoSession} level, as the notion of project
+ * does not exist there.
+ */
+ @Nonnull
+ default Map getEffectiveProperties() {
+ return getEffectiveProperties(null);
+ }
+
+ /**
+ * Each invocation computes a new map of effective properties. To be used in interpolation.
+ *
+ * Effective properties are computed from system, user and optionally project properties, layered with
+ * defined precedence onto each other to achieve proper precedence. Precedence is defined as:
+ *
+ *
System properties (lowest precedence)
+ *
Project properties (optional)
+ *
User properties (highest precedence)
+ *
+ * Note: Project properties contains properties injected from profiles, if applicable. Their precedence is
+ * {@code profile > project}, hence active profile property may override project property.
+ *
+ * The caller of this method should decide whether there is a project in scope (hence, a project instance
+ * needs to be passed) or not.
+ *
+ * @param project {@link Project} or {@code null}.
+ * @return the effective properties, never {@code null}
+ */
+ @Nonnull
+ Map getEffectiveProperties(@Nullable Project project);
+
+ /**
+ * Returns the degree of concurrency for the build.
+ *
+ * @return the degree of concurrency
+ */
+ int getDegreeOfConcurrency();
+
+ /**
+ * Retrieves a list of projects associated with the session.
+ *
+ * @return a list of projects, never {@code null}
+ */
+ @Nonnull
+ List getProjects();
+
+ /**
+ * Returns the plugin context for mojo being executed and the specified
+ * {@link Project}, never returns {@code null} as if context not present, creates it.
+ *
+ * Implementation note: while this method return type is {@link Map}, the
+ * returned map instance implements {@link java.util.concurrent.ConcurrentMap} as well.
+ *
+ * @throws org.apache.maven.api.services.MavenException if not called from the within a mojo execution
+ */
+ @Nonnull
+ Map getPluginContext(@Nonnull Project project);
+
+ /**
+ * Retrieves the service for the interface
+ *
+ * @throws NoSuchElementException if the service could not be found
+ */
+ @Nonnull
+ T getService(@Nonnull Class clazz);
+
+ /**
+ * Creates a derived session using the given local repository.
+ *
+ * @param localRepository the new local repository
+ * @return the derived session
+ * @throws NullPointerException if {@code localRepository} is null
+ */
+ @Nonnull
+ Session withLocalRepository(@Nonnull LocalRepository localRepository);
+
+ /**
+ * Creates a derived session using the given remote repositories.
+ *
+ * @param repositories the new list of remote repositories
+ * @return the derived session
+ * @throws NullPointerException if {@code repositories} is null
+ */
+ @Nonnull
+ Session withRemoteRepositories(@Nonnull List repositories);
+
+ /**
+ * Register the given listener which will receive all events.
+ *
+ * @param listener the listener to register
+ * @throws NullPointerException if {@code listener} is null
+ */
+ void registerListener(@Nonnull Listener listener);
+
+ /**
+ * Unregisters a previously registered listener.
+ *
+ * @param listener the listener to unregister
+ * @throws NullPointerException if {@code listener} is null
+ */
+ void unregisterListener(@Nonnull Listener listener);
+
+ /**
+ * Returns the list of registered listeners.
+ *
+ * @return an immutable collection of listeners, never {@code null}
+ */
+ @Nonnull
+ Collection getListeners();
+
+ /**
+ * Shortcut for {@code getService(RepositoryFactory.class).createLocal(...)}.
+ *
+ * @param path location of the local repository to create
+ * @return cache of artifacts downloaded from a remote repository or built locally
+ *
+ * @see org.apache.maven.api.services.RepositoryFactory#createLocal(Path)
+ */
+ @Nonnull
+ LocalRepository createLocalRepository(@Nonnull Path path);
+
+ /**
+ * Shortcut for {@code getService(RepositoryFactory.class).createRemote(...)}.
+ *
+ * @param id identifier of the remote repository to create
+ * @param url location of the remote repository
+ * @return remote repository that can be used to download or upload artifacts
+ *
+ * @see org.apache.maven.api.services.RepositoryFactory#createRemote(String, String)
+ */
+ @Nonnull
+ RemoteRepository createRemoteRepository(@Nonnull String id, @Nonnull String url);
+
+ /**
+ * Shortcut for {@code getService(RepositoryFactory.class).createRemote(...)}.
+ *
+ * @param repository information needed for establishing connections with remote repository
+ * @return remote repository that can be used to download or upload artifacts
+ *
+ * @see org.apache.maven.api.services.RepositoryFactory#createRemote(Repository)
+ */
+ @Nonnull
+ RemoteRepository createRemoteRepository(@Nonnull Repository repository);
+
+ /**
+ * Creates a coordinates out of string that is formatted like:
+ * {@code :[:[:]]:}.
+ *
+ * Shortcut for {@code getService(ArtifactFactory.class).create(...)}.
+ *
+ * @param coordsString the string having "standard" coordinates.
+ * @return coordinates used to point to the artifact
+ *
+ * @see ArtifactCoordinatesFactory#create(Session, String)
+ */
+ @Nonnull
+ ArtifactCoordinates createArtifactCoordinates(@Nonnull String coordsString);
+
+ /**
+ * Shortcut for {@code getService(ArtifactFactory.class).create(...)}.
+ *
+ * @param groupId the group identifier, or {@code null} is unspecified
+ * @param artifactId the artifact identifier, or {@code null} is unspecified
+ * @param version the artifact version, or {@code null} is unspecified
+ * @param extension the artifact extension, or {@code null} is unspecified
+ * @return coordinates used to point to the artifact
+ *
+ * @see ArtifactCoordinatesFactory#create(Session, String, String, String, String)
+ */
+ @Nonnull
+ ArtifactCoordinates createArtifactCoordinates(String groupId, String artifactId, String version, String extension);
+
+ /**
+ * Shortcut for {@code getService(ArtifactFactory.class).create(...)}.
+ *
+ * @param groupId the group identifier, or {@code null} is unspecified
+ * @param artifactId the artifact identifier, or {@code null} is unspecified
+ * @param version the artifact version, or {@code null} is unspecified
+ * @param classifier the artifact classifier, or {@code null} is unspecified
+ * @param extension the artifact extension, or {@code null} is unspecified
+ * @param type the artifact type, or {@code null} is unspecified
+ * @return coordinates used to point to the artifact
+ *
+ * @see ArtifactCoordinatesFactory#create(Session, String, String, String, String, String, String)
+ */
+ @Nonnull
+ ArtifactCoordinates createArtifactCoordinates(
+ String groupId, String artifactId, String version, String classifier, String extension, String type);
+
+ /**
+ * Shortcut for {@code getService(ArtifactFactory.class).create(...)}.
+ *
+ * @param artifact artifact from which to get coordinates
+ * @return coordinates used to point to the artifact
+ *
+ * @see ArtifactCoordinatesFactory#create(Session, String, String, String, String, String, String)
+ */
+ @Nonnull
+ ArtifactCoordinates createArtifactCoordinates(@Nonnull Artifact artifact);
+
+ /**
+ * Shortcut for {@code getService(DependencyFactory.class).create(...)}.
+ *
+ * @param coordinates artifact coordinates to get as a dependency coordinates
+ * @return dependency coordinates for the given artifact
+ *
+ * @see DependencyCoordinatesFactory#create(Session, ArtifactCoordinates)
+ */
+ @Nonnull
+ DependencyCoordinates createDependencyCoordinates(@Nonnull ArtifactCoordinates coordinates);
+
+ /**
+ * Shortcut for {@code getService(DependencyFactory.class).create(...)}.
+ *
+ * @param dependency dependency for which to get the coordinates
+ * @return coordinates for the given dependency
+ *
+ * @see DependencyCoordinatesFactory#create(Session, Dependency)
+ */
+ @Nonnull
+ DependencyCoordinates createDependencyCoordinates(@Nonnull Dependency dependency);
+
+ /**
+ * Shortcut for {@code getService(ArtifactFactory.class).create(...)}.
+ *
+ * @param groupId the group identifier, or {@code null} is unspecified
+ * @param artifactId the artifact identifier, or {@code null} is unspecified
+ * @param version the artifact version, or {@code null} is unspecified
+ * @param extension the artifact extension, or {@code null} is unspecified
+ * @return artifact with the given coordinates
+ *
+ * @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String)
+ */
+ @Nonnull
+ Artifact createArtifact(String groupId, String artifactId, String version, String extension);
+
+ /**
+ * Shortcut for {@code getService(ArtifactFactory.class).create(...)}.
+ *
+ * @param groupId the group identifier, or {@code null} is unspecified
+ * @param artifactId the artifact identifier, or {@code null} is unspecified
+ * @param version the artifact version, or {@code null} is unspecified
+ * @param classifier the artifact classifier, or {@code null} is unspecified
+ * @param extension the artifact extension, or {@code null} is unspecified
+ * @param type the artifact type, or {@code null} is unspecified
+ * @return artifact with the given coordinates
+ *
+ * @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String, String, String)
+ */
+ @Nonnull
+ Artifact createArtifact(
+ String groupId, String artifactId, String version, String classifier, String extension, String type);
+
+ /**
+ * Shortcut for {@code getService(ArtifactFactory.class).createProduced(...)}.
+ *
+ * @param groupId the group identifier, or {@code null} is unspecified
+ * @param artifactId the artifact identifier, or {@code null} is unspecified
+ * @param version the artifact version, or {@code null} is unspecified
+ * @param extension the artifact extension, or {@code null} is unspecified
+ * @return artifact with the given coordinates
+ *
+ * @see org.apache.maven.api.services.ArtifactFactory#createProduced(Session, String, String, String, String)
+ */
+ @Nonnull
+ ProducedArtifact createProducedArtifact(String groupId, String artifactId, String version, String extension);
+
+ /**
+ * Shortcut for {@code getService(ArtifactFactory.class).createProduced(...)}.
+ *
+ * @param groupId the group identifier, or {@code null} is unspecified
+ * @param artifactId the artifact identifier, or {@code null} is unspecified
+ * @param version the artifact version, or {@code null} is unspecified
+ * @param classifier the artifact classifier, or {@code null} is unspecified
+ * @param extension the artifact extension, or {@code null} is unspecified
+ * @param type the artifact type, or {@code null} is unspecified
+ * @return artifact with the given coordinates
+ *
+ * @see org.apache.maven.api.services.ArtifactFactory#createProduced(Session, String, String, String, String, String, String)
+ */
+ @Nonnull
+ ProducedArtifact createProducedArtifact(
+ String groupId, String artifactId, String version, String classifier, String extension, String type);
+
+ /**
+ * Shortcut for {@code getService(ArtifactResolver.class).resolve(...)}.
+ *
+ * @param coordinates coordinates of the artifact to resolve
+ * @return requested artifact together with the path to its file
+ * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+ *
+ * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+ */
+ @Nonnull
+ DownloadedArtifact resolveArtifact(@Nonnull ArtifactCoordinates coordinates);
+
+ /**
+ * Shortcut for {@code getService(ArtifactResolver.class).resolve(...)}.
+ *
+ * @param coordinates coordinates of the artifact to resolve
+ * @param repositories repositories to use, if {@code null}, the session repositories are used
+ * @return requested artifact together with the path to its file
+ * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+ *
+ * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+ */
+ @Nonnull
+ DownloadedArtifact resolveArtifact(@Nonnull ArtifactCoordinates coordinates, List repositories);
+
+ /**
+ * Shortcut for {@code getService(ArtifactResolver.class).resolve(...)}.
+ *
+ * @param coordinates coordinates of all artifacts to resolve
+ * @return requested artifacts together with the paths to their files
+ * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+ *
+ * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+ */
+ @Nonnull
+ Collection resolveArtifacts(@Nonnull ArtifactCoordinates... coordinates);
+
+ /**
+ * Shortcut for {@code getService(ArtifactResolver.class).resolve(...)}.
+ *
+ * @param coordinates coordinates of all artifacts to resolve
+ * @return requested artifacts together with the paths to their files
+ * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+ *
+ * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+ */
+ @Nonnull
+ Collection resolveArtifacts(@Nonnull Collection extends ArtifactCoordinates> coordinates);
+
+ /**
+ * Shortcut for {@code getService(ArtifactResolver.class).resolve(...)}.
+ *
+ * @param coordinates coordinates of all artifacts to resolve
+ * @param repositories repositories to use, if {@code null}, the session repositories are used
+ * @return requested artifacts together with the paths to their files
+ * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+ *
+ * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+ */
+ @Nonnull
+ Collection resolveArtifacts(
+ @Nonnull Collection extends ArtifactCoordinates> coordinates,
+ @Nullable List repositories);
+
+ /**
+ * Shortcut for {@code getService(ArtifactResolver.class).resolve(...)}.
+ *
+ * @param artifact the artifact to resolve
+ * @return requested artifact together with the path to its file
+ * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+ *
+ * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+ */
+ @Nonnull
+ DownloadedArtifact resolveArtifact(@Nonnull Artifact artifact);
+
+ /**
+ * Shortcut for {@code getService(ArtifactResolver.class).resolve(...)}.
+ *
+ * @param artifact the artifact to resolve
+ * @param repositories repositories to use, if {@code null}, the session repositories are used
+ * @return requested artifact together with the path to its file
+ * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+ *
+ * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+ */
+ @Nonnull
+ DownloadedArtifact resolveArtifact(@Nonnull Artifact artifact, @Nullable List repositories);
+
+ /**
+ * Shortcut for {@code getService(ArtifactResolver.class).resolve(...)}.
+ *
+ * @param artifacts all artifacts to resolve
+ * @return requested artifacts together with the paths to their files
+ * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+ *
+ * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+ */
+ @Nonnull
+ Collection resolveArtifacts(@Nonnull Artifact... artifacts);
+
+ /**
+ * Shortcut for {@code getService(ArtifactInstaller.class).install(...)}.
+ *
+ * @param artifacts the artifacts to install
+ * @throws org.apache.maven.api.services.ArtifactInstallerException if the artifacts installation failed
+ *
+ * @see org.apache.maven.api.services.ArtifactInstaller#install(Session, Collection)
+ */
+ void installArtifacts(@Nonnull ProducedArtifact... artifacts);
+
+ /**
+ * Shortcut for {@code getService(ArtifactInstaller.class).install(...)}.
+ *
+ * @param artifacts the artifacts to install
+ * @throws org.apache.maven.api.services.ArtifactInstallerException if the artifacts installation failed
+ *
+ * @see org.apache.maven.api.services.ArtifactInstaller#install(Session, Collection)
+ */
+ void installArtifacts(@Nonnull Collection artifacts);
+
+ /**
+ * Shortcut for {@code getService(ArtifactDeployer.class).deploy(...)}.
+ *
+ * @param repository the repository where to deploy artifacts
+ * @param artifacts the artifacts to deploy
+ * @throws org.apache.maven.api.services.ArtifactDeployerException if the artifacts deployment failed
+ *
+ * @see org.apache.maven.api.services.ArtifactDeployer#deploy(Session, RemoteRepository, Collection)
+ */
+ void deployArtifact(@Nonnull RemoteRepository repository, @Nonnull ProducedArtifact... artifacts);
+
+ /**
+ * Shortcut for {@code getService(ArtifactManager.class).setPath(...)}.
+ *
+ * @param artifact the artifact for which to associate a path
+ * @param path path to associate to the given artifact
+ *
+ * @see org.apache.maven.api.services.ArtifactManager#setPath(ProducedArtifact, Path)
+ */
+ void setArtifactPath(@Nonnull ProducedArtifact artifact, @Nonnull Path path);
+
+ /**
+ * Shortcut for {@code getService(ArtifactManager.class).getPath(...)}.
+ *
+ * @param artifact the artifact for which to get a path
+ * @return path associated to the given artifact
+ *
+ * @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
+ */
+ @Nonnull
+ Optional getArtifactPath(@Nonnull Artifact artifact);
+
+ /**
+ * Gets the relative path for a locally installed artifact. Note that the artifact need not actually exist yet at
+ * the returned location, the path merely indicates where the artifact would eventually be stored.
+ *
+ * Shortcut for {@code getService(LocalArtifactManager.class).getPathForLocalArtitact(...)}.
+ *
+ * @param artifact the artifact for which to get a local path
+ * @return local path associated to the given artifact, or {@code null} if none
+ *
+ * @see org.apache.maven.api.services.LocalRepositoryManager#getPathForLocalArtifact(Session, LocalRepository, Artifact)
+ */
+ Path getPathForLocalArtifact(@Nonnull Artifact artifact);
+
+ /**
+ * Gets the relative path for an artifact cached from a remote repository.
+ * Note that the artifact need not actually exist yet at the returned location,
+ * the path merely indicates where the artifact would eventually be stored.
+ *
+ * Shortcut for {@code getService(LocalArtifactManager.class).getPathForRemoteArtifact(...)}.
+ *
+ * @param remote the repository from where artifacts are downloaded
+ * @param artifact the artifact for which to get a path
+ * @return path associated to the given artifact
+ *
+ * @see org.apache.maven.api.services.LocalRepositoryManager#getPathForRemoteArtifact(Session, LocalRepository, RemoteRepository, Artifact)
+ */
+ @Nonnull
+ Path getPathForRemoteArtifact(@Nonnull RemoteRepository remote, @Nonnull Artifact artifact);
+
+ /**
+ * Checks whether a given artifact version is considered a {@code SNAPSHOT} or not.
+ *
+ * Shortcut for {@code getService(ArtifactManager.class).isSnapshot(...)}.
+ *
+ * In case there is {@link Artifact} in scope, the recommended way to perform this check is
+ * use of {@link Artifact#isSnapshot()} instead.
+ *
+ * @param version artifact version
+ * @return whether the given version is a snapshot
+ *
+ * @see org.apache.maven.api.services.VersionParser#isSnapshot(String)
+ */
+ boolean isVersionSnapshot(@Nonnull String version);
+
+ /**
+ * Shortcut for {@code getService(DependencyResolver.class).collect(...)}
+ *
+ * @param artifact artifact for which to get the dependencies, including transitive ones
+ * @param scope the {link PathScope} to collect dependencies, must not be {@code null}
+ * @return root node of the dependency graph for the given artifact
+ *
+ * @see org.apache.maven.api.services.DependencyResolver#collect(Session, Artifact, PathScope)
+ * @throws org.apache.maven.api.services.DependencyResolverException if the dependency collection failed
+ */
+ @Nonnull
+ Node collectDependencies(@Nonnull Artifact artifact, @Nonnull PathScope scope);
+
+ /**
+ * Shortcut for {@code getService(DependencyResolver.class).collect(...)}
+ *
+ * @param project project for which to get the dependencies, including transitive ones
+ * @param scope the {link PathScope} to collect dependencies, must not be {@code null}
+ * @return root node of the dependency graph for the given project
+ *
+ * @see org.apache.maven.api.services.DependencyResolver#collect(Session, Project, PathScope)
+ * @throws org.apache.maven.api.services.DependencyResolverException if the dependency collection failed
+ */
+ @Nonnull
+ Node collectDependencies(@Nonnull Project project, @Nonnull PathScope scope);
+
+ /**
+ * Collects the transitive dependencies of some artifacts and builds a dependency graph. Note that this operation is
+ * only concerned about determining the coordinates of the transitive dependencies and does not actually resolve the
+ * artifact files.
+ *
+ * Shortcut for {@code getService(DependencyResolver.class).resolve(...)}
+ *
+ * @param dependency dependency for which to get transitive dependencies
+ * @param scope the {link PathScope} to collect dependencies, must not be {@code null}
+ * @return root node of the dependency graph for the given artifact
+ *
+ * @see org.apache.maven.api.services.DependencyResolver#collect(Session, DependencyCoordinates, PathScope)
+ * @throws org.apache.maven.api.services.DependencyResolverException if the dependency collection failed
+ */
+ @Nonnull
+ Node collectDependencies(@Nonnull DependencyCoordinates dependency, @Nonnull PathScope scope);
+
+ /**
+ * Shortcut for {@code getService(DependencyResolver.class).flatten(...)}.
+ *
+ * @param node node for which to get a flattened list
+ * @param scope build path scope (main compile, test compile, etc.) of desired nodes
+ * @return flattened list of node with the given build path scope
+ * @throws org.apache.maven.api.services.DependencyResolverException if the dependency flattening failed
+ *
+ * @see org.apache.maven.api.services.DependencyResolver#flatten(Session, Node, PathScope)
+ */
+ @Nonnull
+ List flattenDependencies(@Nonnull Node node, @Nonnull PathScope scope);
+
+ /**
+ * Shortcut for {@code getService(DependencyResolver.class).resolve(...).getPaths()}.
+ *
+ * @param dependencyCoordinates coordinates of the dependency for which to get the paths
+ * @return paths to the transitive dependencies of the given dependency
+ *
+ * @see org.apache.maven.api.services.DependencyResolver#resolve(Session, DependencyCoordinates)
+ */
+ @Nonnull
+ List resolveDependencies(@Nonnull DependencyCoordinates dependencyCoordinates);
+
+ /**
+ * Shortcut for {@code getService(DependencyResolver.class).resolve(...).getPaths()}.
+ *
+ * @param dependencyCoordinates coordinates of all dependency for which to get the paths
+ * @return paths to the transitive dependencies of the given dependencies
+ *
+ * @see org.apache.maven.api.services.DependencyResolver#resolve(Session, List)
+ */
+ @Nonnull
+ List resolveDependencies(@Nonnull List dependencyCoordinates);
+
+ /**
+ * Shortcut for {@code getService(DependencyResolver.class).resolve(...).getPaths()}.
+ *
+ * @param project the project for which to get dependencies
+ * @param scope build path scope (main compile, test compile, etc.) of desired paths
+ * @return paths to the transitive dependencies of the given project
+ *
+ * @see org.apache.maven.api.services.DependencyResolver#resolve(Session, Project, PathScope)
+ */
+ @Nonnull
+ List resolveDependencies(@Nonnull Project project, @Nonnull PathScope scope);
+
+ /**
+ * Shortcut for {@code getService(DependencyResolver.class).resolve(...).getDispatchedPaths()}.
+ *
+ * @param dependencyCoordinates coordinates of the dependency for which to get the paths
+ * @param scope build path scope (main compile, test compile, etc.) of desired paths
+ * @param desiredTypes the type of paths to include in the result
+ * @return paths to the transitive dependencies of the given project
+ *
+ * @see org.apache.maven.api.services.DependencyResolver#resolve(Session, Project, PathScope)
+ */
+ @Nonnull
+ Map> resolveDependencies(
+ @Nonnull DependencyCoordinates dependencyCoordinates,
+ @Nonnull PathScope scope,
+ @Nonnull Collection desiredTypes);
+
+ /**
+ * Shortcut for {@code getService(DependencyResolver.class).resolve(...).getDispatchedPaths()}.
+ *
+ * @param project the project for which to get dependencies
+ * @param scope build path scope (main compile, test compile, etc.) of desired paths
+ * @param desiredTypes the type of paths to include in the result
+ * @return paths to the transitive dependencies of the given project
+ *
+ * @see org.apache.maven.api.services.DependencyResolver#resolve(Session, Project, PathScope)
+ */
+ @Nonnull
+ Map> resolveDependencies(
+ @Nonnull Project project, @Nonnull PathScope scope, @Nonnull Collection desiredTypes);
+
+ /**
+ * Resolves an artifact's meta version (if any) to a concrete version.
+ * For example, resolves "1.0-SNAPSHOT" to "1.0-20090208.132618-23".
+ *
+ * Shortcut for {@code getService(VersionResolver.class).resolve(...)}
+ *
+ * @param artifact the artifact for which to resolve the version
+ * @return resolved version of the given artifact
+ * @throws org.apache.maven.api.services.VersionResolverException if the resolution failed
+ *
+ * @see org.apache.maven.api.services.VersionResolver#resolve(Session, ArtifactCoordinates) (String)
+ */
+ @Nonnull
+ Version resolveVersion(@Nonnull ArtifactCoordinates artifact) throws VersionResolverException;
+
+ /**
+ * Expands a version range to a list of matching versions, in ascending order.
+ * For example, resolves "[3.8,4.0)" to "3.8", "3.8.1", "3.8.2".
+ * The returned list of versions is only dependent on the configured repositories and their contents.
+ * The supplied request may also refer to a single concrete version rather than a version range.
+ * In this case though, the result contains simply the (parsed) input version, regardless of the
+ * repositories and their contents.
+ *
+ * @param artifact the artifact for which to resolve the versions
+ * @return a list of resolved {@code Version}s.
+ * @throws org.apache.maven.api.services.VersionRangeResolverException if the resolution failed
+ * @see org.apache.maven.api.services.VersionRangeResolver#resolve(Session, ArtifactCoordinates) (String)
+ */
+ @Nonnull
+ List resolveVersionRange(@Nonnull ArtifactCoordinates artifact) throws VersionResolverException;
+
+ /**
+ * Expands a version range to a list of matching versions, in ascending order.
+ * For example, resolves "[3.8,4.0)" to "3.8", "3.8.1", "3.8.2".
+ * The returned list of versions is only dependent on the configured repositories and their contents.
+ * The supplied request may also refer to a single concrete version rather than a version range.
+ * In this case though, the result contains simply the (parsed) input version, regardless of the
+ * repositories and their contents.
+ *
+ * @param artifact the artifact for which to resolve the versions
+ * @param repositories the repositories to use, or the session repositories if {@code null}
+ * @return a list of resolved {@code Version}s.
+ * @throws org.apache.maven.api.services.VersionRangeResolverException if the resolution failed
+ * @see org.apache.maven.api.services.VersionRangeResolver#resolve(Session, ArtifactCoordinates) (String)
+ */
+ @Nonnull
+ List resolveVersionRange(@Nonnull ArtifactCoordinates artifact, List repositories)
+ throws VersionResolverException;
+
+ /**
+ * Resolves the highest available version of a version range.
+ * The returned version is only dependent on the configured repositories and their contents.
+ * The supplied request may also refer to a single concrete version rather than a version range.
+ * In this case though, the result contains simply the (parsed) input version, regardless of the
+ * repositories and their contents.
+ *
+ * @param artifact the artifact for which to resolve the versions
+ * @param repositories the repositories to use, or the session repositories if {@code null}
+ * @return the highest resolved {@code Version}.
+ * @throws org.apache.maven.api.services.VersionRangeResolverException if the resolution failed
+ * @see org.apache.maven.api.services.VersionRangeResolver#resolve(Session, ArtifactCoordinates) (String)
+ */
+ @Nonnull
+ Optional resolveHighestVersion(@Nonnull ArtifactCoordinates artifact, List repositories)
+ throws VersionResolverException;
+
+ /**
+ * Parses the specified version string, for example "1.0".
+ *
+ * Shortcut for {@code getService(VersionParser.class).parseVersion(...)}.
+ *
+ * @param version the version string to parse
+ * @return the version parsed from the given string
+ * @throws org.apache.maven.api.services.VersionParserException if the parsing failed
+ * @see org.apache.maven.api.services.VersionParser#parseVersion(String)
+ */
+ @Nonnull
+ Version parseVersion(@Nonnull String version);
+
+ /**
+ * Parses the specified version range specification, for example "[1.0,2.0)".
+ *
+ * Shortcut for {@code getService(VersionParser.class).parseVersionRange(...)}.
+ *
+ * @param versionRange the version string to parse
+ * @return the version range parsed from the given string
+ * @throws org.apache.maven.api.services.VersionParserException if the parsing failed
+ * @see org.apache.maven.api.services.VersionParser#parseVersionRange(String)
+ */
+ @Nonnull
+ VersionRange parseVersionRange(@Nonnull String versionRange);
+
+ /**
+ * Parses the specified version constraint specification, for example "1.0" or "[1.0,2.0)".
+ *
+ * Shortcut for {@code getService(VersionParser.class).parseVersionConstraint(...)}.
+ *
+ * @param versionConstraint the version string to parse
+ * @return the version constraint parsed from the given string
+ * @throws org.apache.maven.api.services.VersionParserException if the parsing failed
+ * @see org.apache.maven.api.services.VersionParser#parseVersionConstraint(String)
+ */
+ @Nonnull
+ VersionConstraint parseVersionConstraint(@Nonnull String versionConstraint);
+
+ /**
+ * Obtain the {@link Type} from the specified {@code id}.
+ *
+ * Shortcut for {@code getService(TypeRegistry.class).require(...)}.
+ *
+ * @see org.apache.maven.api.services.TypeRegistry#require(String)
+ */
+ @Nonnull
+ Type requireType(@Nonnull String id);
+
+ /**
+ * Obtain the {@link Language} from the specified {@code id}.
+ *
+ * Shortcut for {@code getService(LanguageRegistry.class).require(...)}.
+ *
+ * @see org.apache.maven.api.services.LanguageRegistry#require(String)
+ */
+ @Nonnull
+ Language requireLanguage(@Nonnull String id);
+
+ /**
+ * Obtain the {@link Packaging} from the specified {@code id}.
+ *
+ * Shortcut for {@code getService(PackagingRegistry.class).require(...)}.
+ *
+ * @see org.apache.maven.api.services.PackagingRegistry#require(String)
+ */
+ @Nonnull
+ Packaging requirePackaging(@Nonnull String id);
+
+ /**
+ * Obtain the {@link ProjectScope} from the specified {@code id}.
+ *
+ * Shortcut for {@code getService(ProjectScopeRegistry.class).require(...)}.
+ *
+ * @see org.apache.maven.api.services.ProjectScopeRegistry#require(String)
+ */
+ @Nonnull
+ ProjectScope requireProjectScope(@Nonnull String id);
+
+ /**
+ * Obtain the {@link DependencyScope} from the specified {@code id}.
+ *
+ * Shortcut for {@code DependencyScope.forId(...)} with a verification that the given identifier exists.
+ *
+ * @param id the identifier of the scope (case-sensitive)
+ * @return the scope for the given identifier (never null)
+ * @throws IllegalArgumentException if the given identifier is not a known scope
+ *
+ * @see org.apache.maven.api.DependencyScope#forId(String)
+ */
+ @Nonnull
+ DependencyScope requireDependencyScope(@Nonnull String id);
+
+ /**
+ * Obtain the {@link PathScope} from the specified {@code id}.
+ *
+ * Shortcut for {@code getService(PathScopeRegistry.class).require(...)}.
+ *
+ * @see org.apache.maven.api.services.PathScopeRegistry#require(String)
+ */
+ @Nonnull
+ PathScope requirePathScope(@Nonnull String id);
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java b/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java
new file mode 100644
index 000000000000..5afb04795a9f
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Objects;
+import java.util.function.Supplier;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+import org.apache.maven.api.annotations.Provider;
+import org.apache.maven.api.annotations.ThreadSafe;
+
+/**
+ * A container for data that is specific to a session.
+ * All components may use this storage to associate arbitrary data with a session.
+ *
+ * Unlike a cache, this session data is not subject to purging. For this same reason, session data should also not be
+ * abused as a cache (i.e. for storing values that can be re-calculated) to avoid memory exhaustion.
+ *
+ * Note: Actual implementations must be thread-safe.
+ *
+ * @see Session#getData()
+ * @since 4.0.0
+ */
+@Experimental
+@ThreadSafe
+@Provider
+public interface SessionData {
+
+ /**
+ * Associates the specified session data with the given key.
+ *
+ * @param key the key under which to store the session data, must not be {@code null}
+ * @param value the data to associate with the key, may be {@code null} to remove the mapping
+ */
+ void set(@Nonnull Key key, @Nullable T value);
+
+ /**
+ * Associates the specified session data with the given key if the key is currently mapped to the given value. This
+ * method provides an atomic compare-and-update of some key's value.
+ *
+ * @param key the key under which to store the session data, must not be {@code null}
+ * @param oldValue the expected data currently associated with the key, may be {@code null}
+ * @param newValue the data to associate with the key, may be {@code null} to remove the mapping
+ * @return {@code true} if the key mapping was successfully updated from the old value to the new value,
+ * {@code false} if the current key mapping didn't match the expected value and was not updated.
+ */
+ boolean replace(@Nonnull Key key, @Nullable T oldValue, @Nullable T newValue);
+
+ /**
+ * Gets the session data associated with the specified key.
+ *
+ * @param key the key for which to retrieve the session data, must not be {@code null}
+ * @return the session data associated with the key or {@code null} if none
+ */
+ @Nullable
+ T get(@Nonnull Key key);
+
+ /**
+ * Retrieve of compute the data associated with the specified key.
+ *
+ * @param key the key for which to retrieve the session data, must not be {@code null}
+ * @param supplier the supplier will compute the new value
+ * @return the session data associated with the key
+ */
+ @Nullable
+ T computeIfAbsent(@Nonnull Key key, @Nonnull Supplier supplier);
+
+ /**
+ * Create a key using the given class as an identifier and as the type of the object.
+ */
+ static Key key(Class clazz) {
+ return new Key<>(clazz, clazz);
+ }
+
+ /**
+ * Create a key using the given class and id.
+ */
+ static Key key(Class clazz, Object id) {
+ return new Key<>(clazz, id);
+ }
+
+ /**
+ * Key used to query the session data
+ * @param the type of the object associated to this key
+ */
+ final class Key {
+
+ private final Class type;
+ private final Object id;
+
+ private Key(Class type, Object id) {
+ this.type = type;
+ this.id = id;
+ }
+
+ public Class type() {
+ return type;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Key> key = (Key>) o;
+ return Objects.equals(id, key.id) && Objects.equals(type, key.type);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, type);
+ }
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java b/api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java
new file mode 100644
index 000000000000..4a4aa4f561aa
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.nio.file.Path;
+import java.nio.file.PathMatcher;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * A root directory of source files.
+ * The sources may be Java main classes, test classes, resources or anything else identified by the scope.
+ *
+ *
Default values
+ * The properties in this interface are defined in the {@code } element of the
+ * {@linkplain org.apache.maven.api.model.Model Maven project descriptor}.
+ * For each property, the default value is either empty or documented in the project descriptor.
+ */
+public interface SourceRoot {
+ /**
+ * {@return the root directory where the sources are stored}.
+ * The path is relative to the POM file.
+ *
+ *
Default implementation
+ * The default value depends on whether a {@linkplain #module() module name} is specified in this source root:
+ *
+ *
+ * If no module name, then the default directory is
+ * src/{@linkplain #scope() scope}/{@linkplain #language() language}.
+ *
+ * If a module name is present, then the default directory is
+ * src/{@linkplain #module() module}/{@linkplain #scope() scope}/{@linkplain #language() language}.
+ *
+ *
+ *
+ * The default value is relative.
+ * Implementation may override with absolute path instead.
+ */
+ default Path directory() {
+ Path src = Path.of("src");
+ return module().map(src::resolve)
+ .orElse(src)
+ .resolve(scope().id())
+ .resolve(language().id());
+ }
+
+ /**
+ * {@return the list of patterns for the files to include}.
+ * The path separator is {@code /} on all platforms, including Windows.
+ * The prefix before the {@code :} character, if present and longer than 1 character, is the syntax.
+ * If no syntax is specified, or if its length is 1 character (interpreted as a Windows drive),
+ * the default is a Maven-specific variation of the {@code "glob"} pattern.
+ *
+ *
The default implementation returns an empty list, which means to apply a language-dependent pattern.
+ * For example, for the Java language, the pattern includes all files with the {@code .java} suffix.
+ *
+ * @see java.nio.file.FileSystem#getPathMatcher(String)
+ */
+ default List includes() {
+ return List.of();
+ }
+
+ /**
+ * {@return the list of patterns for the files to exclude}.
+ * The exclusions are applied after the inclusions.
+ * The default implementation returns an empty list.
+ */
+ default List excludes() {
+ return List.of();
+ }
+
+ /**
+ * {@return a matcher combining the include and exclude patterns}.
+ * If the user did not specify any includes, the given {@code defaultIncludes} are used.
+ * These defaults depend on the plugin.
+ * For example, the default include of the Java compiler plugin is "**/*.java".
+ *
+ *
If the user did not specify any excludes, the default is often files generated
+ * by Source Code Management (SCM) software or by the operating system.
+ * Examples: "**/.gitignore", "**/.DS_Store".
+ *
+ * @param defaultIncludes the default includes if unspecified by the user
+ * @param useDefaultExcludes whether to add the default set of patterns to exclude,
+ * mostly Source Code Management (SCM) files
+ */
+ PathMatcher matcher(Collection defaultIncludes, boolean useDefaultExcludes);
+
+ /**
+ * {@return in which context the source files will be used}.
+ * Not to be confused with dependency scope.
+ * The default value is {@code "main"}.
+ *
+ * @see ProjectScope#MAIN
+ */
+ default ProjectScope scope() {
+ return ProjectScope.MAIN;
+ }
+
+ /**
+ * {@return the language of the source files}.
+ * The default value is {@code "java"}.
+ *
+ * @see Language#JAVA_FAMILY
+ */
+ default Language language() {
+ return Language.JAVA_FAMILY;
+ }
+
+ /**
+ * {@return the name of the Java module (or other language-specific module) which is built by the sources}.
+ * The default value is empty.
+ */
+ default Optional module() {
+ return Optional.empty();
+ }
+
+ /**
+ * {@return the version of the platform where the code will be executed}.
+ * In a Java environment, this is the value of the {@code --release} compiler option.
+ * The default value is empty.
+ */
+ default Optional targetVersion() {
+ return Optional.empty();
+ }
+
+ /**
+ * {@return an explicit target path, overriding the default value}.
+ * When a target path is explicitly specified, the values of the {@link #module()} and {@link #targetVersion()}
+ * elements are not used for inferring the path (they are still used as compiler options however).
+ * It means that for scripts and resources, the files below the path specified by {@link #directory()}
+ * are copied to the path specified by {@code targetPath()} with the exact same directory structure.
+ */
+ default Optional targetPath() {
+ return Optional.empty();
+ }
+
+ /**
+ * {@return whether resources are filtered to replace tokens with parameterized values}.
+ * The default value is {@code false}.
+ */
+ default boolean stringFiltering() {
+ return false;
+ }
+
+ /**
+ * {@return whether the directory described by this source element should be included in the build}.
+ * The default value is {@code true}.
+ */
+ default boolean enabled() {
+ return true;
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Toolchain.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Toolchain.java
new file mode 100644
index 000000000000..dcbe72ea4ade
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Toolchain.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Map;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.toolchain.ToolchainModel;
+
+/**
+ * Represents a toolchain in the Maven build system.
+ *
+ *
A toolchain is a set of tools that can be used to build a project.
+ * This interface allows users to define and configure various toolchains
+ * that can be utilized by Maven during the build process. Toolchains can
+ * include compilers, interpreters, and other tools that are necessary
+ * for building a project in a specific environment.
+ *
+ *
Toolchains are defined in the Maven toolchains.xml file and can be
+ * referenced in the project's POM file. This allows for greater flexibility
+ * and control over the build environment, enabling developers to specify
+ * the exact versions of tools they wish to use.
+ *
+ *
+ * Toolchains can be obtained through the {@link org.apache.maven.api.services.ToolchainManager ToolchainManager}
+ * service. This service provides methods to retrieve and manage toolchains defined
+ * in the Maven configuration.
+ *
+ *
+ *
+ * The following are key functionalities provided by the Toolchain interface:
+ *
Access to the type of the toolchain (e.g., JDK, compiler).
+ *
Retrieval of the specific version of the toolchain.
+ *
Configuration of toolchain properties to match the project's requirements.
+ *
+ *
+ *
Example usage:
+ *
+ * Toolchain toolchain = ...; // Obtain a Toolchain instance
+ * String type = toolchain.getType(); // Get the type of the toolchain
+ * String version = toolchain.getVersion(); // Get the version of the toolchain
+ *
+ *
+ *
+ * @since 4.0.0
+ * @see JavaToolchain
+ * @see org.apache.maven.api.services.ToolchainManager
+ */
+@Experimental
+public interface Toolchain {
+ /**
+ * Gets the type of toolchain.
+ *
+ * @return the toolchain type
+ */
+ String getType();
+
+ /**
+ * Gets the underlying toolchain model.
+ *
+ * @return the toolchain model
+ */
+ ToolchainModel getModel();
+
+ /**
+ * Gets the platform tool executable.
+ *
+ * @param toolName the tool platform independent tool name
+ * @return file representing the tool executable, or null if the tool cannot be found
+ */
+ String findTool(String toolName);
+
+ /**
+ * Let the toolchain decide if it matches requirements defined
+ * in the toolchain plugin configuration.
+ *
+ * @param requirements key value pair, may not be {@code null}
+ * @return {@code true} if the requirements match, otherwise {@code false}
+ */
+ boolean matchesRequirements(Map requirements);
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Type.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Type.java
new file mode 100644
index 000000000000..98861483ff42
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Type.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Set;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+import org.apache.maven.api.model.Dependency;
+
+/**
+ * A dependency's {@code Type} is uniquely identified by a {@code String},
+ * and semantically represents a known kind of dependency.
+ *
+ * It provides information about the file type (or extension) of the associated artifact,
+ * its default classifier, and how the artifact will be used in the build when creating
+ * class paths or module paths.
+ *
+ * For example, the type {@code java-source} has a {@code jar} extension and a
+ * {@code sources} classifier. The artifact and its dependencies should be added
+ * to the build path.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface Type extends ExtensibleEnum {
+ /**
+ * Artifact type name for a POM file.
+ */
+ String POM = "pom";
+
+ /**
+ * Artifact type name for a BOM file.
+ */
+ String BOM = "bom";
+
+ /**
+ * Artifact type name for a JAR file that can be placed either on the class path or on the module path.
+ * The path (classes or modules) is chosen by the plugin, possibly using heuristic rules.
+ * This is the behavior of Maven 3.
+ */
+ String JAR = "jar";
+
+ /**
+ * Artifact type name for a fat-JAR file that can be only on the class path.
+ * The fat-JAR is a self-contained JAR and its transitive dependencies will not be resolved, if any.
+ * This type is new in Maven 4.
+ */
+ String FATJAR = "fatjar";
+
+ /**
+ * Artifact type name for a JAR file to unconditionally place on the class path.
+ * If the JAR is modular, its module information are ignored.
+ * This type is new in Maven 4.
+ */
+ String CLASSPATH_JAR = "classpath-jar";
+
+ /**
+ * Artifact type name for a JAR file to unconditionally place on the module path.
+ * If the JAR is not modular, then it is loaded by Java as an unnamed module.
+ * This type is new in Maven 4.
+ */
+ String MODULAR_JAR = "modular-jar";
+
+ /**
+ * Artifact type name for a JAR file that can be placed either on the annotation processor class path
+ * or module path. The path (classes or modules) is chosen by the plugin, possibly using heuristic rules.
+ */
+ String PROCESSOR = "processor";
+
+ /**
+ * Artifact type name for a JAR file to unconditionally place on the annotation processor class path.
+ * If the JAR is modular, its module information are ignored.
+ */
+ String CLASSPATH_PROCESSOR = "classpath-processor";
+
+ /**
+ * Artifact type name for a JAR file to unconditionally place on the annotation processor module path.
+ * If the JAR is not modular, then it is loaded by Java as an unnamed module.
+ */
+ String MODULAR_PROCESSOR = "modular-processor";
+
+ /**
+ * Artifact type name for source code packaged in a JAR file.
+ */
+ String JAVA_SOURCE = "java-source";
+
+ /**
+ * Artifact type name for javadoc packaged in a JAR file.
+ */
+ String JAVADOC = "javadoc";
+
+ /**
+ * Artifact type name for a Maven plugin.
+ */
+ String MAVEN_PLUGIN = "maven-plugin";
+
+ /**
+ * Artifact type name for a JAR file containing test classes. If the main artifact is placed on the class path
+ * ({@value #JAR} or {@value #CLASSPATH_JAR} types), then the test artifact will also be placed on the class path.
+ * Otherwise, if the main artifact is placed on the module path ({@value #JAR} or {@value #MODULAR_JAR} types),
+ * then the test artifact will be added using {@code --patch-module} option.
+ */
+ String TEST_JAR = "test-jar";
+
+ /**
+ * Artifact type name for a JAR file containing test sources.
+ */
+ String TEST_JAVA_SOURCE = "test-java-source";
+
+ /**
+ * Returns the dependency type id.
+ * The id uniquely identifies this dependency type.
+ *
+ * @return the id of this type, never {@code null}.
+ */
+ @Nonnull
+ @Override
+ String id();
+
+ /**
+ * Returns the dependency type language.
+ *
+ * @return the language of this type, never {@code null}.
+ */
+ @Nonnull
+ Language getLanguage();
+
+ /**
+ * Get the file extension of artifacts of this type.
+ *
+ * @return the file extension, never {@code null}.
+ */
+ @Nonnull
+ String getExtension();
+
+ /**
+ * Get the default classifier associated to the dependency type.
+ * The default classifier can be overridden when specifying
+ * the {@link Dependency#getClassifier()}.
+ *
+ * @return the default classifier, or {@code null}.
+ */
+ @Nullable
+ String getClassifier();
+
+ /**
+ * Specifies if the artifact already embeds its own dependencies.
+ * This is the case for JEE packages or similar artifacts such as
+ * WARs, EARs, etc.
+ *
+ * @return if the artifact's dependencies are included in the artifact
+ */
+ boolean isIncludesDependencies();
+
+ /**
+ * Types of path (class-path, module-path, …) where the dependency can be placed.
+ * For most deterministic builds, the array length should be 1. In such case,
+ * the dependency will be unconditionally placed on the specified type of path
+ * and no heuristic rule will be involved.
+ *
+ *
It is nevertheless common to specify two or more types of path. For example,
+ * a Java library may be compatible with either the class path or the module path,
+ * and the user may have provided no instruction about which type to use. In such
+ * case, the plugin may apply rules for choosing a path. See for example
+ * {@link JavaPathType#CLASSES} and {@link JavaPathType#MODULES}.
+ */
+ @Nonnull
+ Set getPathTypes();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Version.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Version.java
new file mode 100644
index 000000000000..6d533ecfb601
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Version.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * A version or meta-version of an artifact or a dependency.
+ * A meta-version is a version suffixed with the {@code SNAPSHOT} keyword.
+ * Versions are usually parsed using the {@link org.apache.maven.api.services.VersionParser} service.
+ *
+ * @since 4.0.0
+ * @see org.apache.maven.api.services.VersionParser#parseVersion(String)
+ * @see org.apache.maven.api.Session#parseVersion(String)
+ * @see VersionConstraint
+ * @see VersionRange
+ */
+@Experimental
+public interface Version extends Comparable {
+ /**
+ * {@return the string representation of this version}
+ */
+ @Nonnull
+ @Override
+ String toString();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/VersionConstraint.java b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionConstraint.java
new file mode 100644
index 000000000000..5d5ac0fc4f80
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionConstraint.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+
+/**
+ * Version constraint for dependency.
+ * Constraint is either a range ("[1,2)") or recommended version ("1.0").
+ *
+ * {@code VersionConstraint} objects are created using the
+ * {@linkplain org.apache.maven.api.services.VersionParser} service.
+ *
+ * @see Version
+ * @see VersionRange
+ * @see org.apache.maven.api.services.VersionParser#parseVersionConstraint(String)
+ * @see org.apache.maven.api.Session#parseVersionConstraint(String)
+ * @since 4.0.0
+ */
+@Experimental
+public interface VersionConstraint {
+ /**
+ * Returns the range of this constraint, or {@code null} if none.
+ *
+ * Note: only one, this method or {@link #getRecommendedVersion()} method must return non-{@code null} value.
+ */
+ @Nullable
+ VersionRange getVersionRange();
+
+ /**
+ * Returns the recommended version of this constraint, or {@code null} if none.
+ *
+ * Note: only one, this method or {@link #getVersionRange()} method must return non-{@code null} value.
+ */
+ @Nullable
+ Version getRecommendedVersion();
+
+ /**
+ * Determines whether the specified version is contained within this constraint.
+ *
+ * @param version the version to test, must not be {@code null}
+ * @return {@code true} if this range contains the specified version, {@code false} otherwise
+ */
+ boolean contains(@Nonnull Version version);
+
+ /**
+ * {@return the string representation of this version}
+ */
+ @Nonnull
+ @Override
+ String toString();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java
new file mode 100644
index 000000000000..224b5d6f75fb
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+
+/**
+ * A range of versions.
+ *
+ * {@code VersionConstraint} objects are created using the
+ * {@linkplain org.apache.maven.api.services.VersionParser} service.
+ *
+ * @see Version
+ * @see VersionConstraint
+ * @see org.apache.maven.api.services.VersionParser#parseVersionRange(String)
+ * @see org.apache.maven.api.Session#parseVersionRange(String)
+ * @since 4.0.0
+ */
+@Experimental
+public interface VersionRange {
+ /**
+ * Determines whether the specified version is contained within this range.
+ *
+ * @param version the version to test, must not be {@code null}
+ * @return {@code true} if this range contains the specified version, {@code false} otherwise
+ */
+ boolean contains(@Nonnull Version version);
+
+ /**
+ * Returns the upper boundary of this range, or {@code null} if none.
+ */
+ @Nullable
+ Boundary getUpperBoundary();
+
+ /**
+ * Returns the lower boundary of this range, or {@code null} if none.
+ */
+ @Nullable
+ Boundary getLowerBoundary();
+
+ /**
+ * {@return the string representation of this version}
+ */
+ @Nonnull
+ @Override
+ String toString();
+
+ /**
+ * Represents range boundary.
+ */
+ interface Boundary {
+ /**
+ * The bounding version.
+ */
+ Version getVersion();
+
+ /**
+ * Returns {@code true} if version is included of the range.
+ */
+ boolean isInclusive();
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/WorkspaceRepository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/WorkspaceRepository.java
new file mode 100644
index 000000000000..f8cd2bac6d3f
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/WorkspaceRepository.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Represents a repository backed by an IDE workspace, the output of a build session,
+ * or similar ad-hoc collections of artifacts. This repository is considered read-only
+ * within the context of a session, meaning it can only be used for artifact resolution,
+ * not for installation or deployment. This interface does not provide direct access
+ * to artifacts; that functionality is handled by a {@code WorkspaceReader}.
+ */
+public interface WorkspaceRepository extends Repository {
+
+ /**
+ * {@return the type of the repository, i.e. "workspace"}
+ */
+ @Nonnull
+ @Override
+ default String getType() {
+ return "workspace";
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/cache/BatchRequestException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/BatchRequestException.java
new file mode 100644
index 000000000000..4757d60c7abb
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/BatchRequestException.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cache;
+
+import java.util.List;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.services.Request;
+import org.apache.maven.api.services.Result;
+
+/**
+ * Exception thrown when a batch request operation fails. This exception contains the results
+ * of all requests that were attempted, including both successful and failed operations.
+ *
+ * The exception provides access to detailed results through {@link #getResults()}, allowing
+ * callers to determine which specific requests failed and why.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public class BatchRequestException extends RuntimeException {
+
+ private final List> results;
+
+ /**
+ * Constructs a new BatchRequestException with the specified message and results.
+ *
+ * @param The type of the request
+ * @param The type of the response
+ * @param message The error message describing the batch operation failure
+ * @param allResults List of results from all attempted requests in the batch
+ */
+ public , REP extends Result> BatchRequestException(
+ String message, List> allResults) {
+ super(message);
+ this.results = List.copyOf(allResults);
+ }
+
+ /**
+ * Returns the list of results from all requests that were part of the batch operation.
+ * Each result contains the original request, the response (if successful), and any error
+ * that occurred during processing.
+ *
+ * @return An unmodifiable list of request results
+ */
+ public List> getResults() {
+ return results;
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/cache/CacheMetadata.java b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/CacheMetadata.java
new file mode 100644
index 000000000000..ecc9920b226d
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/CacheMetadata.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cache;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nullable;
+
+/**
+ * Interface defining metadata for cache behavior and lifecycle management.
+ * Implementations can specify how long cached data should be retained.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface CacheMetadata {
+
+ /**
+ * Returns the cache retention that should be applied to the associated data.
+ *
+ * @return The CacheRetention indicating how long data should be retained, or null if
+ * no specific cache retention is defined
+ */
+ @Nullable
+ CacheRetention getCacheRetention();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/cache/CacheRetention.java b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/CacheRetention.java
new file mode 100644
index 000000000000..4ec20db8422e
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/CacheRetention.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cache;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Enumeration defining different retention periods for cached data.
+ * Each value represents a specific scope and lifetime for cached items.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public enum CacheRetention {
+ /**
+ * Data should be persisted across Maven invocations.
+ * Suitable for:
+ * - Dependency resolution results
+ * - Compilation outputs
+ * - Downloaded artifacts
+ */
+ PERSISTENT,
+
+ /**
+ * Data should be retained for the duration of the current Maven session.
+ * Suitable for:
+ * - Build-wide configuration
+ * - Project model caching
+ * - Inter-module metadata
+ */
+ SESSION_SCOPED,
+
+ /**
+ * Data should only be retained for the current build request.
+ * Suitable for:
+ * - Plugin execution results
+ * - Temporary build artifacts
+ * - Phase-specific data
+ */
+ REQUEST_SCOPED,
+
+ /**
+ * Caching should be disabled for this data.
+ * Suitable for:
+ * - Sensitive information
+ * - Non-deterministic operations
+ * - Debug or development data
+ */
+ DISABLED
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/cache/MavenExecutionException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/MavenExecutionException.java
new file mode 100644
index 000000000000..a8862e2d339e
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/MavenExecutionException.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cache;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.services.MavenException;
+
+/**
+ * Exception thrown when an error occurs during Maven execution.
+ * This exception wraps the original cause of the execution failure.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public class MavenExecutionException extends MavenException {
+
+ /**
+ * Constructs a new MavenExecutionException with the specified cause.
+ *
+ * @param cause The underlying exception that caused the execution failure
+ */
+ public MavenExecutionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/cache/RequestCache.java b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/RequestCache.java
new file mode 100644
index 000000000000..2a4ad69d834d
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/RequestCache.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cache;
+
+import java.util.List;
+import java.util.function.Function;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.services.Request;
+import org.apache.maven.api.services.Result;
+
+/**
+ * Interface for caching request results in Maven. This cache implementation provides
+ * methods for executing and optionally caching both single requests and batches of requests.
+ *
+ * The cache behavior is determined by the cache retention specified in the request's metadata.
+ * Results can be cached at different policies (forever, session, request, or not at all)
+ * based on the {@link CacheRetention} associated with the request.
+ *
+ * @since 4.0.0
+ * @see CacheMetadata
+ * @see RequestCacheFactory
+ */
+@Experimental
+public interface RequestCache {
+
+ /**
+ * Executes and optionally caches a request using the provided supplier function. If caching is enabled
+ * for this session, the result will be cached and subsequent identical requests will return the cached
+ * value without re-executing the supplier.
+ *
+ * The caching behavior is determined by the cache retention specified in the request's metadata.
+ * If an error occurs during execution, it will be cached and re-thrown for subsequent identical requests.
+ *
+ * @param The request type
+ * @param The response type
+ * @param req The request object used as the cache key
+ * @param supplier The function to execute and cache the result
+ * @return The result from the supplier (either fresh or cached)
+ * @throws RuntimeException Any exception thrown by the supplier will be cached and re-thrown on subsequent calls
+ */
+ , REP extends Result> REP request(REQ req, Function supplier);
+
+ /**
+ * Executes and optionally caches a batch of requests using the provided supplier function.
+ * This method allows for efficient batch processing of multiple requests.
+ *
+ * The implementation may optimize the execution by:
+ *
+ *
Returning cached results for previously executed requests
+ *
Grouping similar requests for batch processing
+ *
Processing requests in parallel where appropriate
+ *
+ *
+ * @param The request type
+ * @param The response type
+ * @param req List of requests to process
+ * @param supplier Function to execute the batch of requests
+ * @return List of results corresponding to the input requests
+ * @throws BatchRequestException if any request in the batch fails
+ */
+ , REP extends Result> List requests(
+ List req, Function, List> supplier);
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/cache/RequestCacheFactory.java b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/RequestCacheFactory.java
new file mode 100644
index 000000000000..dff86d521f76
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/RequestCacheFactory.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cache;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Factory interface for creating new RequestCache instances.
+ * Implementations should handle the creation and configuration of cache instances
+ * based on the current Maven session and environment.
+ *
+ * @since 4.0.0
+ * @see RequestCache
+ */
+@Experimental
+public interface RequestCacheFactory {
+
+ /**
+ * Creates a new RequestCache instance.
+ * The created cache should be configured according to the current Maven session
+ * and environment settings.
+ *
+ * @return A new RequestCache instance
+ */
+ RequestCache createCache();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/cache/RequestResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/RequestResult.java
new file mode 100644
index 000000000000..2876a3bb6a97
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/RequestResult.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.cache;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.services.Request;
+import org.apache.maven.api.services.Result;
+
+/**
+ * A record representing the result of a single request operation, containing the original request,
+ * the result (if successful), and any error that occurred during processing.
+ *
+ * This class is immutable and thread-safe, suitable for use in concurrent operations.
+ *
+ * @param The type of the request
+ * @param The type of the response, which must extend {@code Result}
+ * @param request The original request that was processed
+ * @param result The result of the request, if successful; may be null if an error occurred
+ * @param error Any error that occurred during processing; null if the request was successful
+ * @since 4.0.0
+ */
+@Experimental
+public record RequestResult, REP extends Result>(
+ /**
+ * The original request that was processed
+ */
+ REQ request,
+
+ /**
+ * The result of the request, if successful; may be null if an error occurred
+ */
+ REP result,
+
+ /**
+ * Any error that occurred during processing; null if the request was successful
+ */
+ Throwable error) {
+
+ /**
+ * Determines if the request was processed successfully.
+ *
+ * @return true if no error occurred during processing (error is null), false otherwise
+ */
+ public boolean isSuccess() {
+ return error == null;
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/cache/package-info.java b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/package-info.java
new file mode 100644
index 000000000000..9e6a0f458542
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/cache/package-info.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Provides a caching infrastructure for Maven requests and their results.
+ *
+ * This package contains the core components for implementing and managing caches in Maven:
+ *
+ *
{@link org.apache.maven.api.cache.RequestCache} - The main interface for caching request results
+ *
{@link org.apache.maven.api.cache.RequestCacheFactory} - Factory for creating cache instances
+ *
{@link org.apache.maven.api.cache.CacheMetadata} - Configuration for cache behavior and lifecycle
+ *
+ *
+ * The caching system supports different retention periods through {@link org.apache.maven.api.cache.CacheRetention}:
+ *
+ *
PERSISTENT - Data persists across Maven invocations
+ *
SESSION_SCOPED - Data retained for the duration of a Maven session
+ *
REQUEST_SCOPED - Data retained only for the current build request
+ *
DISABLED - No caching performed
+ *
+ *
+ * Example usage:
+ *
+ * RequestCache cache = cacheFactory.createCache();
+ * Result result = cache.request(myRequest, req -> {
+ * // Expensive operation to compute result
+ * return computedResult;
+ * });
+ *
+ *
+ * The package also provides support for batch operations through {@link org.apache.maven.api.cache.BatchRequestException}
+ * and {@link org.apache.maven.api.cache.RequestResult} which help manage multiple requests and their results.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+package org.apache.maven.api.cache;
+
+import org.apache.maven.api.annotations.Experimental;
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/feature/Features.java b/api/maven-api-core/src/main/java/org/apache/maven/api/feature/Features.java
new file mode 100644
index 000000000000..0005433d63d1
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/feature/Features.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.feature;
+
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.maven.api.Constants;
+import org.apache.maven.api.annotations.Nullable;
+
+/**
+ * Centralized class for Maven Core feature information.
+ * Features configured are supposed to be final in a given maven session.
+ *
+ * @since 4.0.0
+ */
+public final class Features {
+
+ private Features() {}
+
+ /**
+ * Check if the personality is "maven3".
+ */
+ public static boolean mavenMaven3Personality(@Nullable Map userProperties) {
+ return doGet(userProperties, Constants.MAVEN_MAVEN3_PERSONALITY, false);
+ }
+
+ /**
+ * Check if the consumer POM feature is active.
+ */
+ public static boolean consumerPom(@Nullable Map userProperties) {
+ return doGet(userProperties, Constants.MAVEN_CONSUMER_POM, !mavenMaven3Personality(userProperties));
+ }
+
+ /**
+ * Check if build POM deployment is enabled.
+ */
+ public static boolean deployBuildPom(@Nullable Map userProperties) {
+ return doGet(userProperties, Constants.MAVEN_DEPLOY_BUILD_POM, true);
+ }
+
+ private static boolean doGet(Properties userProperties, String key, boolean def) {
+ return doGet(userProperties != null ? userProperties.get(key) : null, def);
+ }
+
+ private static boolean doGet(Map userProperties, String key, boolean def) {
+ return doGet(userProperties != null ? userProperties.get(key) : null, def);
+ }
+
+ private static boolean doGet(Object val, boolean def) {
+ if (val instanceof Boolean bool) {
+ return bool;
+ } else if (val != null) {
+ return Boolean.parseBoolean(val.toString());
+ } else {
+ return def;
+ }
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/feature/package-info.java b/api/maven-api-core/src/main/java/org/apache/maven/api/feature/package-info.java
new file mode 100644
index 000000000000..b10b38ad3cc3
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/feature/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Provides feature flag management and configuration capabilities for Maven core functionality.
+ *
+ * @since 4.0.0
+ */
+package org.apache.maven.api.feature;
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/package-info.java b/api/maven-api-core/src/main/java/org/apache/maven/api/package-info.java
new file mode 100644
index 000000000000..7fd2d60b9591
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/package-info.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ *
Maven Core API
+ *
+ *
Session
+ *
+ *
The {@link org.apache.maven.api.Session} interface is the main entry point for Maven operations.
+ * It maintains the state of a Maven execution and provides access to all core services and components.
+ * Sessions are thread-safe and can be obtained in session-scoped components using the
+ * {@link org.apache.maven.api.di.SessionScoped} annotation.
+ *
+ *
Key capabilities provided through the Session include:
+ *
+ *
Access to the current {@link org.apache.maven.api.Project}
+ *
Access to the {@link org.apache.maven.api.LocalRepository} and {@link org.apache.maven.api.RemoteRepository} configurations
+ *
Access to Maven services through {@link org.apache.maven.api.Session#getService(Class)}
+ *
Build configuration and settings
+ *
+ *
+ *
Dependency management
+ *
+ *
{@link org.apache.maven.api.ArtifactCoordinates} instances are used to locate artifacts in a repository.
+ * Each instance identifies an artifact or version range of artifacts in the Maven repository system.
+ *
+ *
{@link org.apache.maven.api.Artifact} instances represent artifacts in the repository.
+ * They are created when resolving an {@code ArtifactCoordinates} object. Resolving is the process
+ * that selects a particular version and downloads the artifact into the local repository.
+ * The {@link org.apache.maven.api.DownloadedArtifact} sub-interface is used when
+ * an artifact has been resolved and the {@link org.apache.maven.api.ProducedArtifact} sub-interface when
+ * an artifact is being produced by a project.
+ *
+ *
{@link org.apache.maven.api.DependencyCoordinates} instances represent a dependency element in a POM.
+ * A {@code DependencyCoordinates} extends {@code ArtifactCoordinates} with additional information about how
+ * the artifact will be used: type, scope and obligation (whether the dependency is optional or mandatory).
+ * The version and the obligation may not be defined precisely.
+ *
+ *
{@link org.apache.maven.api.Dependency} instances represent artifacts in the repository
+ * that are dependencies of the project.
+ * They are created when resolving a {@code DependencyCoordinates}.
+ * Resolving is the process that clarifies the obligation (optional or mandatory),
+ * selects a particular version, and downloads the artifact into the local repository.
+ *
+ *
{@link org.apache.maven.api.Node} is the main output of the dependency collection process.
+ * It's a node in the dependency graph and contains a {@code Dependency} instance. The {@code Dependency} instances are the outputs of the
+ * collection process, part of the graph computed from one or more {@code DependencyCoordinates}.
+ *
+ *
{@link org.apache.maven.api.DependencyScope} defines when/how a given dependency will be used by the
+ * project. This includes compile-time only, runtime, test time, and various other combinations.
+ *
+ *
Resolution
+ *
+ *
Version resolution is the process of finding, for a given artifact, a list of
+ * versions that match the input {@linkplain org.apache.maven.api.VersionConstraint version constraint}
+ * in the list of remote repositories. This is done either explicitly using the
+ * {@link org.apache.maven.api.services.VersionResolver VersionResolver} service, or implicitly when resolving
+ * an artifact.
+ *
+ *
Artifact resolution is the process of {@linkplain org.apache.maven.api.services.VersionResolver
+ * resolving the version} and then downloading the file.
+ *
+ *
Dependency collection builds a graph of {@link org.apache.maven.api.Node} objects containing
+ * all the dependencies.
+ *
+ *
The Dependency graph flattening process in Maven reduces a complex,
+ * multi-level dependency graph to a map of ordered lists that can be turned into classpaths.
+ * During this process only the most relevant version of each artifact
+ * (based on group ID and artifact ID) is retained, resolving conflicts and eliminating duplicates to ensure
+ * that each dependency is included only once in the final build.
+ *
+ *
Dependency resolution is the process of collecting dependencies, flattening the result graph,
+ * and then resolving the artifacts.
+ *
+ *
Repositories
+ *
+ *
In Maven, {@linkplain org.apache.maven.api.Repository repositories} are locations where project artifacts (such as JAR files, POM files, and other
+ * resources) are stored and retrieved. There are two primary types of repositories:
+ *
{@linkplain org.apache.maven.api.LocalRepository local repository}: A directory on the developer's machine where Maven caches
+ * downloaded artifacts.
+ *
{@linkplain org.apache.maven.api.RemoteRepository remote repository}: A central or distributed location from which Maven can download artifacts
+ * when they are not available locally.
+ *
+ *
+ *
When resolving artifacts, Maven follows this order:
+ *
Check Local Repository: Maven first checks if the artifact is available in the local repository.
+ *
Check Remote Repositories: If the artifact is not found locally, Maven queries the configured remote repositories in the order they are listed.
+ *
Download and Cache: If Maven finds the artifact in a remote repository, it downloads it and stores it in the local repository for future use.
+ *
+ *
By caching artifacts in the local repository, Maven minimizes the need to repeatedly download the same artifacts, thus optimizing the build process.
+ *
+ *
Projects
+ *
+ *
{@link org.apache.maven.api.Project} instances are loaded by Maven from the local
+ * file system (those projects are usually about to be built) or from the local repository
+ * (they are usually downloaded during dependency collection). Those projects are loaded
+ * from a Project Object Model (POM).
+ *
+ *
Project Object Model or POM refers to the information describing
+ * all the information needed to build or consume a project. Those are usually loaded from
+ * a file named {@code pom.xml} and loaded into a {@link org.apache.maven.api.model.Model Model}
+ * instances.
+ *
+ *
Project aggregation allows building several projects together. This is only
+ * for projects that are built, hence available on the file system. One project,
+ * called the aggregator project lists one or more modules
+ * which are relative pointers on the file system to other projects. This is done using
+ * the {@code /project/modules/module} elements of the POM in the aggregator project.
+ * Note that the aggregator project is required to have a {@code pom} packaging.
+ *
+ *
Project inheritance defines a parent-child relationship between projects.
+ * The child project inherits all the information from the parent project
+ * POM.
+ *
+ */
+package org.apache.maven.api;
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/LifecycleProvider.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/LifecycleProvider.java
new file mode 100644
index 000000000000..1f0d61b2c413
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/LifecycleProvider.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.plugin;
+
+import java.util.List;
+
+import org.apache.maven.api.annotations.Consumer;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.plugin.descriptor.lifecycle.Lifecycle;
+
+/**
+ * Interface that can be provided by the plugin to wire in custom lifecycles
+ * leveraged using the {@link org.apache.maven.api.plugin.annotations.Execute}
+ * annotation. If a {@code META-INF/maven/lifecycle.xml} file is packaged
+ * in the plugin, Maven will provide a default implementation that will parse
+ * the file and return the contained lifecycle definitions.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Consumer
+public interface LifecycleProvider {
+
+ List getLifecycles();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Log.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Log.java
new file mode 100644
index 000000000000..f2968295e456
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Log.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.plugin;
+
+import java.util.function.Supplier;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Provider;
+
+/**
+ * This interface supplies the API for providing feedback to the user from the {@code Mojo},
+ * using standard Maven channels.
+ * There should be no big surprises here, although you may notice that the methods accept
+ * java.lang.CharSequence rather than java.lang.String. This is provided mainly as a
+ * convenience, to enable developers to pass things like java.lang.StringBuffer directly into the logger,
+ * rather than formatting first by calling toString().
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Provider
+public interface Log {
+ /**
+ * {@return true if the debug error level is enabled}
+ */
+ boolean isDebugEnabled();
+
+ /**
+ * Sends a message to the user in the debug error level.
+ *
+ * @param content the message to log
+ */
+ void debug(CharSequence content);
+
+ /**
+ * Sends a message (and accompanying exception) to the user in the debug error level.
+ * The error's stacktrace will be output when this error level is enabled.
+ *
+ * @param content the message to log
+ * @param error the error that caused this log
+ */
+ void debug(CharSequence content, Throwable error);
+
+ /**
+ * Sends an exception to the user in the debug error level.
+ * The stack trace for this exception will be output when this error level is enabled.
+ *
+ * @param error the error that caused this log
+ */
+ void debug(Throwable error);
+
+ void debug(Supplier content);
+
+ void debug(Supplier content, Throwable error);
+
+ /**
+ * {@return true if the info error level is enabled}
+ */
+ boolean isInfoEnabled();
+
+ /**
+ * Sends a message to the user in the info error level.
+ *
+ * @param content the message to log
+ */
+ void info(CharSequence content);
+
+ /**
+ * Sends a message (and accompanying exception) to the user in the info error level.
+ * The error's stacktrace will be output when this error level is enabled.
+ *
+ * @param content the message to log
+ * @param error the error that caused this log
+ */
+ void info(CharSequence content, Throwable error);
+
+ /**
+ * Sends an exception to the user in the info error level.
+ * The stack trace for this exception will be output when this error level is enabled.
+ *
+ * @param error the error that caused this log
+ */
+ void info(Throwable error);
+
+ void info(Supplier content);
+
+ void info(Supplier content, Throwable error);
+
+ /**
+ * {@return true if the warn error level is enabled}
+ */
+ boolean isWarnEnabled();
+
+ /**
+ * Sends a message to the user in the warn error level.
+ *
+ * @param content the message to log
+ */
+ void warn(CharSequence content);
+
+ /**
+ * Sends a message (and accompanying exception) to the user in the warn error level.
+ * The error's stacktrace will be output when this error level is enabled.
+ *
+ * @param content the message to log
+ * @param error the error that caused this log
+ */
+ void warn(CharSequence content, Throwable error);
+
+ /**
+ * Sends an exception to the user in the warn error level.
+ * The stack trace for this exception will be output when this error level is enabled.
+ *
+ * @param error the error that caused this log
+ */
+ void warn(Throwable error);
+
+ void warn(Supplier content);
+
+ void warn(Supplier content, Throwable error);
+
+ /**
+ * {@return true if the error error level is enabled}
+ */
+ boolean isErrorEnabled();
+
+ /**
+ * Sends a message to the user in the error error level.
+ *
+ * @param content the message to log
+ */
+ void error(CharSequence content);
+
+ /**
+ * Sends a message (and accompanying exception) to the user in the error error level.
+ * The error's stacktrace will be output when this error level is enabled.
+ *
+ * @param content the message to log
+ * @param error the error that caused this log
+ */
+ void error(CharSequence content, Throwable error);
+
+ /**
+ * Sends an exception to the user in the error error level.
+ * The stack trace for this exception will be output when this error level is enabled.
+ *
+ * @param error the error that caused this log
+ */
+ void error(Throwable error);
+
+ void error(Supplier content);
+
+ void error(Supplier content, Throwable error);
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Mojo.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Mojo.java
new file mode 100644
index 000000000000..277d4ba6ffe1
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Mojo.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.plugin;
+
+import org.apache.maven.api.annotations.Consumer;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.ThreadSafe;
+
+/**
+ * Represents the contract for Mojos to interact with the Maven infrastructure.
+ * Implementations of this interface define specific build-process behaviors
+ * that are triggered during a Maven build lifecycle.
+ *
+ * The primary entry point is the {@link #execute()} method, which encapsulates
+ * the behavior of the Mojo and serves as the integration point with Maven. This
+ * method may throw an {@link Exception} to signal any issues that prevent
+ * successful execution of the Mojo.
+ *
+ *
+ * Annotations:
+ *
+ *
+ *
{@link Experimental}: Indicates that this interface or its implementation
+ * may still be evolving and could change in future versions.
+ *
{@link FunctionalInterface}: Denotes that this is a functional interface,
+ * allowing implementations as lambda expressions or method references.
+ *
{@link Consumer}: Signifies that this type is intended to be implemented
+ * or extended by Maven plugins or extensions and consumed by Maven itself.
+ *
{@link ThreadSafe}: Implies that implementations of this interface must
+ * be safe to invoke from multiple threads concurrently.
+ *
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@FunctionalInterface
+@Consumer
+@ThreadSafe
+public interface Mojo {
+ /**
+ * Executes the behavior defined by this {@code Mojo}. This method is invoked
+ * during the Maven build lifecycle to perform the Mojo's designated task.
+ *
+ *
Implementations should handle any task-specific logic and may communicate
+ * errors by throwing an {@link Exception}. Error conditions should provide
+ * sufficient detail to aid troubleshooting.
+ *
+ * @throws Exception if any issue occurs that prevents the successful execution
+ * of the Mojo
+ */
+ void execute() throws Exception;
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/MojoException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/MojoException.java
new file mode 100644
index 000000000000..2d4b976cee79
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/MojoException.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.plugin;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.services.MavenException;
+
+/**
+ * An exception occurring during the execution of a plugin.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public class MojoException extends MavenException {
+
+ protected Object source;
+
+ protected String longMessage;
+
+ /**
+ * Constructs a new {@code MojoException} providing the source and a short and long message.
+ * These messages are used to improve the message written at the end of Maven build.
+ */
+ public MojoException(Object source, String shortMessage, String longMessage) {
+ super(shortMessage);
+ this.source = source;
+ this.longMessage = longMessage;
+ }
+
+ /**
+ * Constructs a new {@code MojoException} wrapping an underlying {@code Throwable}
+ * and providing a {@code message}.
+ */
+ public MojoException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new {@code MojoException} providing a {@code message}.
+ */
+ public MojoException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new {@code MojoExecutionException} wrapping an underlying {@code Throwable}.
+ *
+ * @param cause the cause which is saved for later retrieval by the {@link #getCause()} method.
+ * A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
+ */
+ public MojoException(Throwable cause) {
+ super(cause);
+ }
+
+ public String getLongMessage() {
+ return longMessage;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/After.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/After.java
new file mode 100644
index 000000000000..697b9d480206
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/After.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.plugin.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Specifies that the mojo should be run after the specific phase.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface After {
+
+ /**
+ * Type of pointer.
+ * @see org.apache.maven.api.Lifecycle.Pointer.Type
+ */
+ enum Type {
+ PROJECT,
+ DEPENDENCIES,
+ CHILDREN
+ }
+
+ /**
+ * The phase name.
+ */
+ String phase();
+
+ /**
+ * The type of this pointer.
+ */
+ Type type();
+
+ /**
+ * The scope for dependencies, only if {@code type() == Type.Dependencies}.
+ */
+ String scope() default "";
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Execute.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Execute.java
new file mode 100644
index 000000000000..f4830b87ae0b
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Execute.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.plugin.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Used if your Mojo needs to fork a lifecycle.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface Execute {
+ /**
+ * Lifecycle phase to fork. Note that specifying a phase overrides specifying a goal.
+ * @return the phase
+ */
+ @Nonnull
+ String phase() default "";
+
+ /**
+ * Goal to fork. Note that specifying a phase overrides specifying a goal. The specified goal must be
+ * another goal of the same plugin.
+ * @return the goal
+ */
+ @Nonnull
+ String goal() default "";
+
+ /**
+ * Lifecycle id of the lifecycle that defines {@link #phase()}. Only valid in combination with {@link #phase()}. If
+ * not specified, Maven will use the lifecycle of the current build.
+ *
+ * @see Lifecycle Mappings
+ * @return the lifecycle id
+ */
+ @Nonnull
+ String lifecycle() default "";
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Mojo.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Mojo.java
new file mode 100644
index 000000000000..009c2541f369
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Mojo.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.plugin.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * This annotation will mark your class as a Mojo, which is the implementation of a goal in a Maven plugin.
+ *
+ * The mojo can be annotated with {@code org.apache.maven.api.di.*} annotations to
+ * control the lifecycle of the mojo itself, and to inject other beans.
+ *
+ *
+ * The mojo class can also be injected with an {@link Execute} annotation to specify a
+ * forked lifecycle.
+ *
+ *
+ * The {@link Parameter} annotation can be added on fields to inject data
+ * from the plugin configuration or from other components.
+ *
+ *
+ * Fields can also be annotated with the {@link Resolution} annotation to be injected
+ * with the dependency collection or resolution result for the project.
+ *
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface Mojo {
+ /**
+ * goal name (required).
+ * @return the goal name
+ */
+ @Nonnull
+ String name();
+
+ /**
+ * default phase to bind your mojo.
+ * @return the default phase
+ */
+ @Nonnull
+ String defaultPhase() default "";
+
+ /**
+ * does your mojo requires a project to be executed?
+ * @return requires a project
+ */
+ boolean projectRequired() default true;
+
+ /**
+ * if the Mojo uses the Maven project and its subprojects.
+ * @return uses the Maven project and its subprojects
+ */
+ boolean aggregator() default false;
+
+ /**
+ * does this Mojo need to be online to be executed?
+ * @return need to be online
+ */
+ boolean onlineRequired() default false;
+
+ /**
+ * TODO: v4: add a SPI for the configurator
+ * configurator bean name.
+ * @return the configurator bean name
+ */
+ @Nonnull
+ String configurator() default "";
+
+ /**
+ * Indicates whether dependency collection will be
+ * required when executing the Mojo.
+ * If not set, it will be inferred from the fields
+ * annotated with the {@link Resolution} annotation.
+ */
+ @Nonnull
+ boolean dependencyCollection() default false;
+
+ /**
+ * Comma separated list of path scopes that will be
+ * required for dependency resolution.
+ * If not set, it will be inferred from the fields
+ * annotated with the {@link Resolution} annotation.
+ */
+ @Nonnull
+ String dependencyResolutionPathScopes() default "";
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Parameter.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Parameter.java
new file mode 100644
index 000000000000..64b129ae4ebe
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Parameter.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.plugin.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Used to configure your Mojo parameters to be injected by
+ *
+ * MavenPluginManager.getConfiguredMojo(...).
+ *
+ * Beans injected into Mojo parameters are prepared by Sisu JSR330-based
+ * container: this annotation is only effective on fields of the Mojo class itself, nested bean injection
+ * requires Sisu or JSR330 annotations.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.METHOD})
+@Inherited
+public @interface Parameter {
+ /**
+ * name of the bean property used to get/set the field: by default, field name is used.
+ * @return the name of the bean property
+ */
+ @Nonnull
+ String name() default "";
+
+ /**
+ * alias supported to get parameter value.
+ * @return the alias
+ */
+ @Nonnull
+ String alias() default "";
+
+ /**
+ * Property to use to retrieve a value. Can come from -D execution, setting properties or pom
+ * properties.
+ * @return property name
+ */
+ @Nonnull
+ String property() default "";
+
+ /**
+ * parameter default value, may contain ${...} expressions which will be interpreted at
+ * inject time: see
+ *
+ * PluginParameterExpressionEvaluator.
+ * @return the default value
+ */
+ @Nonnull
+ String defaultValue() default "";
+
+ /**
+ * is the parameter required?
+ * @return true if the Mojo should fail when the parameter cannot be injected
+ */
+ boolean required() default false;
+
+ /**
+ * Specifies that this parameter cannot be configured directly by the user (as in the case of POM-specified
+ * configuration). This is useful when you want to force the user to use common POM elements rather than plugin
+ * configurations, as in the case where you want to use the artifact's final name as a parameter. In this case, you
+ * want the user to modify <build><finalName/></build> rather than specifying a value
+ * for finalName directly in the plugin configuration section. It is also useful to ensure that - for example - a
+ * List-typed parameter which expects items of type Artifact doesn't get a List full of Strings.
+ *
+ * @return true if the user should not be allowed to configure the parameter directly
+ */
+ boolean readonly() default false;
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Resolution.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Resolution.java
new file mode 100644
index 000000000000..6e745a0dd417
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Resolution.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.plugin.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Indicates that a given field will be injected with the result of
+ * a dependency collection or resolution request. Whether a collection
+ * or resolution request is performed is controlled by the {@link #pathScope()}
+ * field, the injected field type and the {@link #requestType()}.
+ *
+ * If the {@code requestType} is not set explicitly, it will be inferred
+ * from the {@code pathScope} and the injected field type. If the type
+ * is {@link org.apache.maven.api.Node Node} and {@code pathScope == ""},
+ * then the dependencies will be collected.
+ * If the type is {@link org.apache.maven.api.Node Node} or
+ * {@code List<}{@link org.apache.maven.api.Node Node}{@code >},
+ * and {@code pathScope != ""}, the dependencies will be flattened.
+ * Else the dependencies will be resolved and {@code pathScope} must be non empty,
+ * and the field type can be {@link org.apache.maven.api.Node Node},
+ * {@code List<}{@link org.apache.maven.api.Node Node}{@code >},
+ * {@link org.apache.maven.api.services.DependencyResolverResult DependencyResolverResult},
+ * {@code List<}{@link java.nio.file.Path Path}{@code >},
+ * {@code Map<}{@link org.apache.maven.api.PathType PathType}{@code , List<}{@link java.nio.file.Path Path}{@code >>},
+ * or {@code Map<}{@link org.apache.maven.api.Dependency Dependency}{@code , }{@link java.nio.file.Path Path}{@code >}.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Resolution {
+
+ /**
+ * The id of a {@link org.apache.maven.api.PathScope} enum value.
+ * If specified, a dependency resolution request will be issued,
+ * else a dependency collection request will be done.
+ *
+ * @return the id of the path scope
+ */
+ String pathScope() default "";
+
+ /**
+ * The request type, in case the default one is not correct.
+ * Valid values are {@code collect}, {@code flatten}, or {@code resolve}.
+ *
+ * @return the request type
+ */
+ String requestType() default "";
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/package-info.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/package-info.java
new file mode 100644
index 000000000000..14d2c7a2ef1c
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Maven Plugin Annotations.
+ */
+package org.apache.maven.api.plugin.annotations;
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/package-info.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/package-info.java
new file mode 100644
index 000000000000..1bed56a81bfe
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Maven Plugin API.
+ */
+package org.apache.maven.api.plugin;
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactory.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactory.java
new file mode 100644
index 000000000000..50fa35c04c4e
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactory.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.ArtifactCoordinates;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Service used to create {@link ArtifactCoordinates} objects.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface ArtifactCoordinatesFactory extends Service {
+
+ /**
+ * Creates artifact coordinates.
+ *
+ * @param request the request holding coordinates creation parameters
+ * @return an {@code ArtifactCoordinates}, never {@code null}
+ * @throws IllegalArgumentException if {@code request} is null or {@code request.session} is null or invalid
+ */
+ @Nonnull
+ ArtifactCoordinates create(@Nonnull ArtifactCoordinatesFactoryRequest request);
+
+ /**
+ * Creates coordinates out of string that is formatted like:
+ * {@code :[:[:]]:}
+ *
+ * @param session the session.
+ * @param coordinatesString the string having "standard" coordinates.
+ * @return an {@code ArtifactCoordinates}, never {@code null}
+ * @throws IllegalArgumentException if {@code session} is null or invalid
+ */
+ @Nonnull
+ default ArtifactCoordinates create(@Nonnull Session session, @Nonnull String coordinatesString) {
+ return create(ArtifactCoordinatesFactoryRequest.build(session, coordinatesString));
+ }
+
+ @Nonnull
+ default ArtifactCoordinates create(
+ @Nonnull Session session, String groupId, String artifactId, String version, String extension) {
+ return create(ArtifactCoordinatesFactoryRequest.build(session, groupId, artifactId, version, extension));
+ }
+
+ @Nonnull
+ default ArtifactCoordinates create(
+ @Nonnull Session session,
+ String groupId,
+ String artifactId,
+ String version,
+ String classifier,
+ String extension,
+ String type) {
+ return create(ArtifactCoordinatesFactoryRequest.build(
+ session, groupId, artifactId, version, classifier, extension, type));
+ }
+
+ @Nonnull
+ default ArtifactCoordinates create(@Nonnull Session session, Artifact artifact) {
+ return create(ArtifactCoordinatesFactoryRequest.build(
+ session,
+ artifact.getGroupId(),
+ artifact.getArtifactId(),
+ artifact.getVersion().toString(),
+ artifact.getClassifier(),
+ artifact.getExtension(),
+ null));
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java
new file mode 100644
index 000000000000..d2c3540f3c2b
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.util.Objects;
+
+import org.apache.maven.api.ArtifactCoordinates;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.NotThreadSafe;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * A request for creating a {@link ArtifactCoordinates} object.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactCoordinatesFactoryRequest extends Request {
+
+ String getGroupId();
+
+ String getArtifactId();
+
+ String getVersion();
+
+ String getClassifier();
+
+ String getExtension();
+
+ String getType();
+
+ String getCoordinatesString();
+
+ @Nonnull
+ static ArtifactCoordinatesFactoryRequest build(
+ @Nonnull Session session, String groupId, String artifactId, String version, String extension) {
+ return ArtifactCoordinatesFactoryRequest.builder()
+ .session(requireNonNull(session, "session"))
+ .groupId(groupId)
+ .artifactId(artifactId)
+ .version(version)
+ .extension(extension)
+ .build();
+ }
+
+ @Nonnull
+ static ArtifactCoordinatesFactoryRequest build(
+ @Nonnull Session session,
+ String groupId,
+ String artifactId,
+ String version,
+ String classifier,
+ String extension,
+ String type) {
+ return ArtifactCoordinatesFactoryRequest.builder()
+ .session(requireNonNull(session, "session"))
+ .groupId(groupId)
+ .artifactId(artifactId)
+ .version(version)
+ .classifier(classifier)
+ .extension(extension)
+ .type(type)
+ .build();
+ }
+
+ @Nonnull
+ static ArtifactCoordinatesFactoryRequest build(@Nonnull Session session, @Nonnull String coordinateString) {
+ return ArtifactCoordinatesFactoryRequest.builder()
+ .session(requireNonNull(session, "session"))
+ .coordinateString(requireNonNull(coordinateString, "coordinateString"))
+ .build();
+ }
+
+ @Nonnull
+ static ArtifactCoordinatesFactoryRequest build(@Nonnull Session session, @Nonnull ArtifactCoordinates coordinates) {
+ return ArtifactCoordinatesFactoryRequest.builder()
+ .session(requireNonNull(session, "session"))
+ .groupId(requireNonNull(coordinates, "coordinates").getGroupId())
+ .artifactId(coordinates.getArtifactId())
+ .classifier(coordinates.getClassifier())
+ .version(coordinates.getVersionConstraint().toString())
+ .extension(coordinates.getExtension())
+ .build();
+ }
+
+ static ArtifactFactoryRequestBuilder builder() {
+ return new ArtifactFactoryRequestBuilder();
+ }
+
+ @NotThreadSafe
+ class ArtifactFactoryRequestBuilder {
+ private Session session;
+ private RequestTrace trace;
+ private String groupId;
+ private String artifactId;
+ private String version;
+ private String classifier;
+ private String extension;
+ private String type;
+ private String coordinateString;
+
+ ArtifactFactoryRequestBuilder() {}
+
+ public ArtifactFactoryRequestBuilder session(Session session) {
+ this.session = session;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder trace(RequestTrace trace) {
+ this.trace = trace;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder groupId(String groupId) {
+ this.groupId = groupId;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder artifactId(String artifactId) {
+ this.artifactId = artifactId;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder version(String version) {
+ this.version = version;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder classifier(String classifier) {
+ this.classifier = classifier;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder extension(String extension) {
+ this.extension = extension;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder coordinateString(String coordinateString) {
+ this.coordinateString = coordinateString;
+ return this;
+ }
+
+ public ArtifactCoordinatesFactoryRequest build() {
+ return new DefaultArtifactFactoryRequestArtifact(
+ session, trace, groupId, artifactId, version, classifier, extension, type, coordinateString);
+ }
+
+ private static class DefaultArtifactFactoryRequestArtifact extends BaseRequest
+ implements ArtifactCoordinatesFactoryRequest {
+ private final String groupId;
+ private final String artifactId;
+ private final String version;
+ private final String classifier;
+ private final String extension;
+ private final String type;
+ private final String coordinatesString;
+
+ @SuppressWarnings("checkstyle:ParameterNumber")
+ DefaultArtifactFactoryRequestArtifact(
+ @Nonnull Session session,
+ RequestTrace trace,
+ String groupId,
+ String artifactId,
+ String version,
+ String classifier,
+ String extension,
+ String type,
+ String coordinatesString) {
+ super(session, trace);
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.version = version;
+ this.classifier = classifier;
+ this.extension = extension;
+ this.type = type;
+ this.coordinatesString = coordinatesString;
+ }
+
+ @Override
+ public String getGroupId() {
+ return groupId;
+ }
+
+ @Override
+ public String getArtifactId() {
+ return artifactId;
+ }
+
+ @Override
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public String getClassifier() {
+ return classifier;
+ }
+
+ @Override
+ public String getExtension() {
+ return extension;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public String getCoordinatesString() {
+ return coordinatesString;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return o instanceof DefaultArtifactFactoryRequestArtifact that
+ && Objects.equals(groupId, that.groupId)
+ && Objects.equals(artifactId, that.artifactId)
+ && Objects.equals(version, that.version)
+ && Objects.equals(classifier, that.classifier)
+ && Objects.equals(extension, that.extension)
+ && Objects.equals(type, that.type)
+ && Objects.equals(coordinatesString, that.coordinatesString);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(groupId, artifactId, version, classifier, extension, type, coordinatesString);
+ }
+
+ @Override
+ public String toString() {
+ return "ArtifactFactoryRequestArtifact[" + "groupId='"
+ + groupId + '\'' + ", artifactId='"
+ + artifactId + '\'' + ", version='"
+ + version + '\'' + ", classifier='"
+ + classifier + '\'' + ", extension='"
+ + extension + '\'' + ", type='"
+ + type + '\'' + ", coordinatesString='"
+ + coordinatesString + '\'' + ']';
+ }
+ }
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployer.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployer.java
new file mode 100644
index 000000000000..d041960d577f
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployer.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.util.Collection;
+
+import org.apache.maven.api.ProducedArtifact;
+import org.apache.maven.api.RemoteRepository;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Deploys {@link ProducedArtifact}s to a {@link RemoteRepository}.
+ *
+ * @since 4.0.0
+ * @see Session#deployArtifact(RemoteRepository, ProducedArtifact...)
+ */
+@Experimental
+public interface ArtifactDeployer extends Service {
+
+ /**
+ * @param request {@link ArtifactDeployerRequest}
+ * @throws ArtifactDeployerException if the deployment failed
+ */
+ void deploy(@Nonnull ArtifactDeployerRequest request);
+
+ /**
+ * @param session the repository session
+ * @param repository the repository to deploy to
+ * @param artifacts the collection of artifacts to deploy
+ * @throws ArtifactDeployerException if the deployment failed
+ * @throws IllegalArgumentException if an argument is {@code null} or invalid
+ */
+ default void deploy(
+ @Nonnull Session session,
+ @Nonnull RemoteRepository repository,
+ @Nonnull Collection artifacts) {
+ deploy(ArtifactDeployerRequest.build(session, repository, artifacts));
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerException.java
new file mode 100644
index 000000000000..6604c0392a11
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerException.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.io.Serial;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * An artifact could not correctly being deployed.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public class ArtifactDeployerException extends MavenException {
+
+ /**
+ *
+ */
+ @Serial
+ private static final long serialVersionUID = 7421964724059077698L;
+
+ /**
+ * @param message the message of the error
+ * @param e {@link Exception}
+ */
+ public ArtifactDeployerException(String message, Exception e) {
+ super(message, e);
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java
new file mode 100644
index 000000000000..8d54d882c0fb
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+import org.apache.maven.api.ProducedArtifact;
+import org.apache.maven.api.RemoteRepository;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * A request for deploying one or more artifacts to a remote repository.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactDeployerRequest extends Request {
+
+ @Nonnull
+ RemoteRepository getRepository();
+
+ @Nonnull
+ Collection getArtifacts();
+
+ int getRetryFailedDeploymentCount();
+
+ @Nonnull
+ static ArtifactDeployerRequestBuilder builder() {
+ return new ArtifactDeployerRequestBuilder();
+ }
+
+ @Nonnull
+ static ArtifactDeployerRequest build(
+ @Nonnull Session session,
+ @Nonnull RemoteRepository repository,
+ @Nonnull Collection artifacts) {
+ return builder()
+ .session(requireNonNull(session, "session cannot be null"))
+ .repository(requireNonNull(repository, "repository cannot be null"))
+ .artifacts(requireNonNull(artifacts, "artifacts cannot be null"))
+ .build();
+ }
+
+ class ArtifactDeployerRequestBuilder {
+ Session session;
+ RequestTrace trace;
+ RemoteRepository repository;
+ Collection artifacts;
+ int retryFailedDeploymentCount;
+
+ ArtifactDeployerRequestBuilder() {}
+
+ @Nonnull
+ public ArtifactDeployerRequestBuilder session(Session session) {
+ this.session = session;
+ return this;
+ }
+
+ @Nonnull
+ public ArtifactDeployerRequestBuilder trace(RequestTrace trace) {
+ this.trace = trace;
+ return this;
+ }
+
+ @Nonnull
+ public ArtifactDeployerRequestBuilder repository(RemoteRepository repository) {
+ this.repository = repository;
+ return this;
+ }
+
+ public ArtifactDeployerRequestBuilder artifacts(Collection artifacts) {
+ this.artifacts = artifacts;
+ return this;
+ }
+
+ public ArtifactDeployerRequestBuilder retryFailedDeploymentCount(int retryFailedDeploymentCount) {
+ this.retryFailedDeploymentCount = retryFailedDeploymentCount;
+ return this;
+ }
+
+ @Nonnull
+ public ArtifactDeployerRequest build() {
+ return new DefaultArtifactDeployerRequest(
+ session, trace, repository, artifacts, retryFailedDeploymentCount);
+ }
+
+ private static class DefaultArtifactDeployerRequest extends BaseRequest
+ implements ArtifactDeployerRequest {
+
+ private final RemoteRepository repository;
+ private final Collection artifacts;
+ private final int retryFailedDeploymentCount;
+
+ DefaultArtifactDeployerRequest(
+ @Nonnull Session session,
+ @Nullable RequestTrace trace,
+ @Nonnull RemoteRepository repository,
+ @Nonnull Collection artifacts,
+ int retryFailedDeploymentCount) {
+ super(session, trace);
+ this.repository = requireNonNull(repository, "repository cannot be null");
+ this.artifacts = List.copyOf(requireNonNull(artifacts, "artifacts cannot be null"));
+ this.retryFailedDeploymentCount = retryFailedDeploymentCount;
+ }
+
+ @Nonnull
+ @Override
+ public RemoteRepository getRepository() {
+ return repository;
+ }
+
+ @Nonnull
+ @Override
+ public Collection getArtifacts() {
+ return artifacts;
+ }
+
+ @Override
+ public int getRetryFailedDeploymentCount() {
+ return retryFailedDeploymentCount;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return o instanceof DefaultArtifactDeployerRequest that
+ && retryFailedDeploymentCount == that.retryFailedDeploymentCount
+ && Objects.equals(repository, that.repository)
+ && Objects.equals(artifacts, that.artifacts);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(repository, artifacts, retryFailedDeploymentCount);
+ }
+
+ @Override
+ public String toString() {
+ return "ArtifactDeployerRequest[" + "repository="
+ + repository + ", artifacts="
+ + artifacts + ", retryFailedDeploymentCount="
+ + retryFailedDeploymentCount + ']';
+ }
+ }
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactory.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactory.java
new file mode 100644
index 000000000000..da77fc2d52bc
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactory.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.ProducedArtifact;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Service used to create {@link Artifact} objects.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface ArtifactFactory extends Service {
+
+ /**
+ * Creates an artifact.
+ *
+ * @param request the request holding artifact creation parameters
+ * @return an {@code Artifact}, never {@code null}
+ * @throws IllegalArgumentException if {@code request} is null or {@code request.session} is null or invalid
+ */
+ @Nonnull
+ Artifact create(@Nonnull ArtifactFactoryRequest request);
+
+ @Nonnull
+ default Artifact create(
+ @Nonnull Session session, String groupId, String artifactId, String version, String extension) {
+ return create(ArtifactFactoryRequest.build(session, groupId, artifactId, version, extension));
+ }
+
+ @Nonnull
+ default Artifact create(
+ @Nonnull Session session,
+ String groupId,
+ String artifactId,
+ String version,
+ String classifier,
+ String extension,
+ String type) {
+ return create(ArtifactFactoryRequest.build(session, groupId, artifactId, version, classifier, extension, type));
+ }
+
+ /**
+ * Creates an artifact.
+ *
+ * @param request the request holding artifact creation parameters
+ * @return an {@code Artifact}, never {@code null}
+ * @throws IllegalArgumentException if {@code request} is null or {@code request.session} is null or invalid
+ */
+ @Nonnull
+ ProducedArtifact createProduced(@Nonnull ArtifactFactoryRequest request);
+
+ @Nonnull
+ default ProducedArtifact createProduced(
+ @Nonnull Session session, String groupId, String artifactId, String version, String extension) {
+ return createProduced(ArtifactFactoryRequest.build(session, groupId, artifactId, version, extension));
+ }
+
+ @Nonnull
+ default ProducedArtifact createProduced(
+ @Nonnull Session session,
+ String groupId,
+ String artifactId,
+ String version,
+ String classifier,
+ String extension,
+ String type) {
+ return createProduced(
+ ArtifactFactoryRequest.build(session, groupId, artifactId, version, classifier, extension, type));
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactoryRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactoryRequest.java
new file mode 100644
index 000000000000..0d9792237400
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactoryRequest.java
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.util.Objects;
+
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.NotThreadSafe;
+import org.apache.maven.api.annotations.Nullable;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ *
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactFactoryRequest extends Request {
+
+ String getGroupId();
+
+ String getArtifactId();
+
+ String getVersion();
+
+ String getClassifier();
+
+ String getExtension();
+
+ String getType();
+
+ static ArtifactFactoryRequest build(
+ Session session, String groupId, String artifactId, String version, String extension) {
+ return ArtifactFactoryRequest.builder()
+ .session(requireNonNull(session, "session cannot be null"))
+ .groupId(groupId)
+ .artifactId(artifactId)
+ .version(version)
+ .extension(extension)
+ .build();
+ }
+
+ static ArtifactFactoryRequest build(
+ Session session,
+ String groupId,
+ String artifactId,
+ String version,
+ String classifier,
+ String extension,
+ String type) {
+ return ArtifactFactoryRequest.builder()
+ .session(requireNonNull(session, "session cannot be null"))
+ .groupId(groupId)
+ .artifactId(artifactId)
+ .version(version)
+ .classifier(classifier)
+ .extension(extension)
+ .type(type)
+ .build();
+ }
+
+ static ArtifactFactoryRequestBuilder builder() {
+ return new ArtifactFactoryRequestBuilder();
+ }
+
+ @NotThreadSafe
+ class ArtifactFactoryRequestBuilder {
+ private Session session;
+ private RequestTrace trace;
+ private String groupId;
+ private String artifactId;
+ private String version;
+ private String classifier;
+ private String extension;
+ private String type;
+
+ ArtifactFactoryRequestBuilder() {}
+
+ public ArtifactFactoryRequestBuilder session(Session session) {
+ this.session = session;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder trace(RequestTrace trace) {
+ this.trace = trace;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder groupId(String groupId) {
+ this.groupId = groupId;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder artifactId(String artifactId) {
+ this.artifactId = artifactId;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder version(String version) {
+ this.version = version;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder classifier(String classifier) {
+ this.classifier = classifier;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder extension(String extension) {
+ this.extension = extension;
+ return this;
+ }
+
+ public ArtifactFactoryRequestBuilder type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public ArtifactFactoryRequest build() {
+ return new DefaultArtifactFactoryRequest(
+ session, trace, groupId, artifactId, version, classifier, extension, type);
+ }
+
+ private static class DefaultArtifactFactoryRequest extends BaseRequest
+ implements ArtifactFactoryRequest {
+ private final String groupId;
+ private final String artifactId;
+ private final String version;
+ private final String classifier;
+ private final String extension;
+ private final String type;
+
+ @SuppressWarnings("checkstyle:ParameterNumber")
+ DefaultArtifactFactoryRequest(
+ @Nonnull Session session,
+ @Nullable RequestTrace trace,
+ String groupId,
+ String artifactId,
+ String version,
+ String classifier,
+ String extension,
+ String type) {
+ super(session, trace);
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.version = version;
+ this.classifier = classifier;
+ this.extension = extension;
+ this.type = type;
+ }
+
+ @Override
+ public String getGroupId() {
+ return groupId;
+ }
+
+ @Override
+ public String getArtifactId() {
+ return artifactId;
+ }
+
+ @Override
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public String getClassifier() {
+ return classifier;
+ }
+
+ @Override
+ public String getExtension() {
+ return extension;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return o instanceof DefaultArtifactFactoryRequest that
+ && Objects.equals(groupId, that.groupId)
+ && Objects.equals(artifactId, that.artifactId)
+ && Objects.equals(version, that.version)
+ && Objects.equals(classifier, that.classifier)
+ && Objects.equals(extension, that.extension)
+ && Objects.equals(type, that.type);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(groupId, artifactId, version, classifier, extension, type);
+ }
+
+ @Override
+ public String toString() {
+ return "ArtifactFactoryRequest[" + "groupId='"
+ + groupId + '\'' + ", artifactId='"
+ + artifactId + '\'' + ", version='"
+ + version + '\'' + ", classifier='"
+ + classifier + '\'' + ", extension='"
+ + extension + '\'' + ", type='"
+ + type + '\'' + ']';
+ }
+ }
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java
new file mode 100644
index 000000000000..f17daa76acee
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.apache.maven.api.ProducedArtifact;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Installs {@link ProducedArtifact}s to the local repository.
+ *
+ * @since 4.0.0
+ * @see Session#withLocalRepository(org.apache.maven.api.LocalRepository)
+ */
+@Experimental
+public interface ArtifactInstaller extends Service {
+ /**
+ * @param request {@link ArtifactInstallerRequest}
+ * @throws ArtifactInstallerException in case of an error
+ * @throws IllegalArgumentException in case {@code request} is {@code null}
+ */
+ void install(@Nonnull ArtifactInstallerRequest request);
+
+ /**
+ * @param session the repository session
+ * @param artifact the {@link ProducedArtifact} to install
+ * @throws ArtifactInstallerException in case of an error which can be a given artifact cannot be found or the
+ * installation has failed
+ * @throws IllegalArgumentException if a parameter {@code session} is {@code null} or
+ * {@code artifact} is {@code null}
+ */
+ default void install(Session session, ProducedArtifact artifact) {
+ install(session, Collections.singletonList(artifact));
+ }
+
+ /**
+ * @param session the repository session
+ * @param artifacts Collection of {@link ProducedArtifact MavenArtifacts}
+ * @throws ArtifactInstallerException if the given artifact cannot be found or the
+ * installation has failed
+ * @throws IllegalArgumentException if {@code request} is {@code null} or parameter
+ * {@code localRepository} is {@code null} or {@code localRepository} is not a directory
+ * or parameter {@code mavenArtifacts} is {@code null} or
+ * {@code mavenArtifacts.isEmpty()} is {@code true}.
+ */
+ default void install(Session session, Collection artifacts) {
+ install(ArtifactInstallerRequest.build(session, artifacts));
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerException.java
new file mode 100644
index 000000000000..8405fc301766
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerException.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.io.Serial;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * @since 4.0.0
+ */
+@Experimental
+public class ArtifactInstallerException extends MavenException {
+
+ /**
+ *
+ */
+ @Serial
+ private static final long serialVersionUID = 3652561971360586373L;
+
+ /**
+ * @param message the message of the error
+ * @param e {@link Exception}
+ */
+ public ArtifactInstallerException(String message, Exception e) {
+ super(message, e);
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java
new file mode 100644
index 000000000000..6f5a57e0ea2b
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
+import org.apache.maven.api.ProducedArtifact;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.NotThreadSafe;
+import org.apache.maven.api.annotations.Nullable;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * A request for installing one or more artifacts in the local repository.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactInstallerRequest extends Request {
+
+ @Nonnull
+ Collection getArtifacts();
+
+ @Nonnull
+ static ArtifactInstallerRequestBuilder builder() {
+ return new ArtifactInstallerRequestBuilder();
+ }
+
+ @Nonnull
+ static ArtifactInstallerRequest build(Session session, Collection artifacts) {
+ return builder()
+ .session(requireNonNull(session, "session cannot be null"))
+ .artifacts(requireNonNull(artifacts, "artifacts cannot be null"))
+ .build();
+ }
+
+ @NotThreadSafe
+ class ArtifactInstallerRequestBuilder {
+ Session session;
+ RequestTrace trace;
+ Collection artifacts = Collections.emptyList();
+
+ ArtifactInstallerRequestBuilder() {}
+
+ @Nonnull
+ public ArtifactInstallerRequestBuilder session(@Nonnull Session session) {
+ this.session = session;
+ return this;
+ }
+
+ @Nonnull
+ public ArtifactInstallerRequestBuilder trace(RequestTrace trace) {
+ this.trace = trace;
+ return this;
+ }
+
+ @Nonnull
+ public ArtifactInstallerRequestBuilder artifacts(@Nullable Collection artifacts) {
+ this.artifacts = artifacts != null ? artifacts : Collections.emptyList();
+ return this;
+ }
+
+ @Nonnull
+ public ArtifactInstallerRequest build() {
+ return new DefaultArtifactInstallerRequest(session, trace, artifacts);
+ }
+
+ static class DefaultArtifactInstallerRequest extends BaseRequest implements ArtifactInstallerRequest {
+
+ private final Collection artifacts;
+
+ DefaultArtifactInstallerRequest(
+ @Nonnull Session session,
+ @Nullable RequestTrace trace,
+ @Nonnull Collection artifacts) {
+ super(session, trace);
+ this.artifacts = List.copyOf(requireNonNull(artifacts, "artifacts cannot be null"));
+ }
+
+ @Nonnull
+ @Override
+ public Collection getArtifacts() {
+ return artifacts;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return o instanceof DefaultArtifactInstallerRequest that && Objects.equals(artifacts, that.artifacts);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(artifacts);
+ }
+
+ @Override
+ public String toString() {
+ return "ArtifactInstallerRequest[" + "artifacts=" + artifacts + ']';
+ }
+ }
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactManager.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactManager.java
new file mode 100644
index 000000000000..8eb1739eafd7
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactManager.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.nio.file.Path;
+import java.util.Optional;
+
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.ProducedArtifact;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface ArtifactManager extends Service {
+
+ /**
+ * Returns the path of the file previously associated to this artifact
+ * or {@code Optional.empty()} if no path has been associated.
+ */
+ @Nonnull
+ Optional getPath(@Nonnull Artifact artifact);
+
+ /**
+ * Associates the given file path to the artifact.
+ */
+ void setPath(@Nonnull ProducedArtifact artifact, Path path);
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java
new file mode 100644
index 000000000000..c4c413c5470c
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.maven.api.ArtifactCoordinates;
+import org.apache.maven.api.RemoteRepository;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Resolves the artifact, i.e. download the file when required and attach it to the artifact
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public interface ArtifactResolver extends Service {
+
+ /**
+ * @param request {@link ArtifactResolverRequest}
+ * @return {@link ArtifactResolverResult}
+ * @throws ArtifactResolverException in case of an error
+ * @throws IllegalArgumentException in case of parameter {@code buildingRequest} is {@code null} or
+ * parameter {@code mavenArtifact} is {@code null} or invalid
+ */
+ ArtifactResolverResult resolve(ArtifactResolverRequest request);
+
+ /**
+ * Resolves several artifacts from their coordinates.
+ *
+ * @param session {@link Session}
+ * @param coordinates array of {@link ArtifactCoordinates}
+ * @return {@link ArtifactResolverResult}
+ * @throws ArtifactResolverException in case of an error.
+ * @throws IllegalArgumentException in case of parameter {@code buildingRequest} is {@code null} or
+ * parameter {@code coordinates} is {@code null} or invalid
+ */
+ default ArtifactResolverResult resolve(Session session, Collection extends ArtifactCoordinates> coordinates) {
+ return resolve(ArtifactResolverRequest.build(session, coordinates));
+ }
+
+ /**
+ * Resolves several artifacts from their coordinates.
+ *
+ * @param session {@link Session}
+ * @param repositories the list of remote repositories or {@code null} to use the session repositories
+ * @param coordinates array of {@link ArtifactCoordinates}
+ * @return {@link ArtifactResolverResult}
+ * @throws ArtifactResolverException in case of an error.
+ * @throws IllegalArgumentException in case of parameter {@code buildingRequest} is {@code null} or
+ * parameter {@code coordinates} is {@code null} or invalid
+ */
+ default ArtifactResolverResult resolve(
+ Session session,
+ Collection extends ArtifactCoordinates> coordinates,
+ List repositories) {
+ return resolve(ArtifactResolverRequest.build(session, coordinates, repositories));
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverException.java
new file mode 100644
index 000000000000..22f398c06575
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverException.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.io.Serial;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ *
+ *
+ * @since 4.0.0
+ */
+@Experimental
+public class ArtifactResolverException extends MavenException {
+
+ @Serial
+ private static final long serialVersionUID = 7252294837746943917L;
+
+ private final ArtifactResolverResult result;
+
+ /**
+ * @param message the message for the exception
+ * @param e the exception itself
+ * @param result the resolution result containing detailed information
+ */
+ public ArtifactResolverException(String message, Exception e, ArtifactResolverResult result) {
+ super(message, e);
+ this.result = result;
+ }
+
+ public ArtifactResolverResult getResult() {
+ return result;
+ }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverRequest.java
new file mode 100644
index 000000000000..fb012fab30df
--- /dev/null
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverRequest.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.services;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+import org.apache.maven.api.ArtifactCoordinates;
+import org.apache.maven.api.RemoteRepository;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.NotThreadSafe;
+import org.apache.maven.api.annotations.Nullable;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * A request for resolving an artifact.
+ *
+ * @since 4.0.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactResolverRequest extends Request {
+
+ @Nonnull
+ Collection extends ArtifactCoordinates> getCoordinates();
+
+ @Nullable
+ List