@eventmodelers/cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -0
- package/cli.js +676 -0
- package/package.json +35 -0
- package/shared/build-kit/code-export.mjs +560 -0
- package/shared/build-kit/lib/ollama-agent.js +147 -0
- package/shared/build-kit/package.json +11 -0
- package/shared/build-kit/ralph-ollama.js +39 -0
- package/shared/build-kit/realtime-agent.js +18 -0
- package/stacks/axon/templates/.claude/skills/build-automation/SKILL.md +407 -0
- package/stacks/axon/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +114 -0
- package/stacks/axon/templates/.claude/skills/build-automation-workflow/SKILL.md +496 -0
- package/stacks/axon/templates/.claude/skills/build-automation-workflow/references/axon-workflow-api.md +279 -0
- package/stacks/axon/templates/.claude/skills/build-automation-workflow/references/feature-flag-patterns.md +114 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/SKILL.md +396 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/references/axon-test-fixture-patterns.md +162 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +56 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/references/rest-api-patterns.md +115 -0
- package/stacks/axon/templates/.claude/skills/build-state-view/SKILL.md +282 -0
- package/stacks/axon/templates/.claude/skills/connect/SKILL.md +178 -0
- package/stacks/axon/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +611 -0
- package/stacks/axon/templates/.claude/skills/load-slice/SKILL.md +141 -0
- package/stacks/axon/templates/.claude/skills/update-slice-status/SKILL.md +105 -0
- package/stacks/axon/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/axon/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/axon/templates/build-kit/lib/backend-prompt.md +158 -0
- package/stacks/axon/templates/build-kit/lib/prompt.md +126 -0
- package/stacks/axon/templates/build-kit/lib/ralph.js +369 -0
- package/stacks/axon/templates/build-kit/ralph-claude.js +44 -0
- package/stacks/axon/templates/build-kit/ralph.sh +98 -0
- package/stacks/axon/templates/root/.env.example +5 -0
- package/stacks/axon/templates/root/CLAUDE.md +60 -0
- package/stacks/axon/templates/root/README.md +44 -0
- package/stacks/axon/templates/root/docker-compose.yml +64 -0
- package/stacks/axon/templates/root/mvnw +259 -0
- package/stacks/axon/templates/root/mvnw.cmd +149 -0
- package/stacks/axon/templates/root/pom.xml +125 -0
- package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/QuickstartApplication.java +128 -0
- package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/config/WebConfig.java +155 -0
- package/stacks/axon/templates/root/src/main/resources/application.properties +2 -0
- package/stacks/axon/templates/root/src/main/resources/static/bg-body.png +0 -0
- package/stacks/axon/templates/root/src/main/resources/static/bg-header.png +0 -0
- package/stacks/axon/templates/root/src/main/resources/static/index.html +596 -0
- package/stacks/cratis-csharp/templates/.claude/skills/_shared/cratis-conventions.md +251 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-automation/SKILL.md +99 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-automation/references/patterns.md +115 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-change/SKILL.md +163 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-change/references/patterns.md +234 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-view/SKILL.md +120 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-view/references/patterns.md +166 -0
- package/stacks/cratis-csharp/templates/.claude/skills/connect/SKILL.md +169 -0
- package/stacks/cratis-csharp/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +609 -0
- package/stacks/cratis-csharp/templates/.claude/skills/load-slice/SKILL.md +141 -0
- package/stacks/cratis-csharp/templates/.claude/skills/update-slice-status/SKILL.md +105 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/AGENT.md +58 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/backend-prompt.md +129 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/prompt.md +124 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/ralph.js +302 -0
- package/stacks/cratis-csharp/templates/build-kit/ralph-claude.js +37 -0
- package/stacks/cratis-csharp/templates/build-kit/ralph.sh +98 -0
- package/stacks/cratis-csharp/templates/root/.frontend/index.css +29 -0
- package/stacks/cratis-csharp/templates/root/.frontend/index.html +17 -0
- package/stacks/cratis-csharp/templates/root/.frontend/main.tsx +18 -0
- package/stacks/cratis-csharp/templates/root/.frontend/tsconfig.json +42 -0
- package/stacks/cratis-csharp/templates/root/.frontend/tsconfig.node.json +11 -0
- package/stacks/cratis-csharp/templates/root/.frontend/vite.config.ts +56 -0
- package/stacks/cratis-csharp/templates/root/App.tsx +23 -0
- package/stacks/cratis-csharp/templates/root/CLAUDE.md +62 -0
- package/stacks/cratis-csharp/templates/root/CratisApp.csproj +25 -0
- package/stacks/cratis-csharp/templates/root/CratisApp.sln +18 -0
- package/stacks/cratis-csharp/templates/root/GlobalUsings.cs +3 -0
- package/stacks/cratis-csharp/templates/root/Home.tsx +102 -0
- package/stacks/cratis-csharp/templates/root/Program.cs +26 -0
- package/stacks/cratis-csharp/templates/root/README.md +192 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/AllListings.ts +47 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/Listing.cs +11 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/Listing.ts +12 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/ListingDataTable.tsx +17 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/index.ts +1 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/Register.ts +51 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/RegisterDialog.tsx +18 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/Registration.cs +27 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/index.ts +1 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/SomeFeature.tsx +22 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/SomeName.cs +3 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/index.ts +1 -0
- package/stacks/cratis-csharp/templates/root/appsettings.Development.json +9 -0
- package/stacks/cratis-csharp/templates/root/appsettings.json +26 -0
- package/stacks/cratis-csharp/templates/root/docker-compose.yml +23 -0
- package/stacks/cratis-csharp/templates/root/package.json +33 -0
- package/stacks/cratis-csharp/templates/root/tsconfig.json +3 -0
- package/stacks/modeling-kit/templates/.claude/settings.local.json +13 -0
- package/stacks/modeling-kit/templates/.claude/skills/analyze-existing-model/SKILL.md +215 -0
- package/stacks/modeling-kit/templates/.claude/skills/attributes/SKILL.md +176 -0
- package/stacks/modeling-kit/templates/.claude/skills/connect/SKILL.md +182 -0
- package/stacks/modeling-kit/templates/.claude/skills/discover-storyboard/SKILL.md +383 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-applying-conways-law/SKILL.md +465 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/SKILL.md +587 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/references/facilitating-event-modeling-workshops.md +626 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-checking-completeness/SKILL.md +542 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-designing-event-models/SKILL.md +497 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/SKILL.md +783 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-inputs/SKILL.md +604 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-outputs/SKILL.md +699 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-integrating-legacy-systems/SKILL.md +674 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/SKILL.md +231 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/domain-patterns.md +150 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/patterns.md +329 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/snapshotting.md +204 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/SKILL.md +352 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/references/project-planning-with-event-modeling.md +341 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-plotting-events/SKILL.md +153 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/SKILL.md +136 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/examples.md +78 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/patterns.md +85 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-storyboarding-events/SKILL.md +655 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-translating-external-events/SKILL.md +479 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models/SKILL.md +234 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models-checklist/SKILL.md +353 -0
- package/stacks/modeling-kit/templates/.claude/skills/examples/SKILL.md +200 -0
- package/stacks/modeling-kit/templates/.claude/skills/handle-comment/SKILL.md +94 -0
- package/stacks/modeling-kit/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +441 -0
- package/stacks/modeling-kit/templates/.claude/skills/place-element/SKILL.md +290 -0
- package/stacks/modeling-kit/templates/.claude/skills/storyboard/SKILL.md +212 -0
- package/stacks/modeling-kit/templates/.claude/skills/storyboard-screen/SKILL.md +123 -0
- package/stacks/modeling-kit/templates/.claude/skills/timeline/SKILL.md +353 -0
- package/stacks/modeling-kit/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
- package/stacks/modeling-kit/templates/.claude/skills/wdyt/SKILL.md +134 -0
- package/stacks/modeling-kit/templates/kit/lib/agent.sh +20 -0
- package/stacks/modeling-kit/templates/kit/lib/ollama-agent.js +147 -0
- package/stacks/modeling-kit/templates/kit/lib/ralph.js +286 -0
- package/stacks/modeling-kit/templates/kit/package.json +12 -0
- package/stacks/modeling-kit/templates/kit/ralph-claude.js +50 -0
- package/stacks/modeling-kit/templates/kit/ralph-ollama.js +38 -0
- package/stacks/modeling-kit/templates/kit/ralph.sh +61 -0
- package/stacks/modeling-kit/templates/kit/realtime-agent.js +18 -0
- package/stacks/modeling-kit/templates/root/CLAUDE.md +56 -0
- package/stacks/node/templates/.claude/skills/build-automation/SKILL.md +266 -0
- package/stacks/node/templates/.claude/skills/build-state-change/SKILL.md +344 -0
- package/stacks/node/templates/.claude/skills/build-state-view/SKILL.md +412 -0
- package/stacks/node/templates/.claude/skills/connect/SKILL.md +178 -0
- package/stacks/node/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +628 -0
- package/stacks/node/templates/.claude/skills/load-slice/SKILL.md +143 -0
- package/stacks/node/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
- package/stacks/node/templates/build-kit/README.md +86 -0
- package/stacks/node/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/node/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/node/templates/build-kit/lib/backend-prompt.md +152 -0
- package/stacks/node/templates/build-kit/lib/prompt.md +122 -0
- package/stacks/node/templates/build-kit/lib/ralph.js +369 -0
- package/stacks/node/templates/build-kit/ralph-claude.js +44 -0
- package/stacks/node/templates/build-kit/ralph.sh +98 -0
- package/stacks/node/templates/root/.env.example +15 -0
- package/stacks/node/templates/root/CLAUDE.md +60 -0
- package/stacks/node/templates/root/docker-compose.yml +15 -0
- package/stacks/node/templates/root/flyway.conf +17 -0
- package/stacks/node/templates/root/migrations/V1__schema.sql.example +12 -0
- package/stacks/node/templates/root/package.json +50 -0
- package/stacks/node/templates/root/server.ts +130 -0
- package/stacks/node/templates/root/setup-env.sh +53 -0
- package/stacks/node/templates/root/src/common/assertions.ts +6 -0
- package/stacks/node/templates/root/src/common/db.ts +32 -0
- package/stacks/node/templates/root/src/common/loadPostgresEventstore.ts +23 -0
- package/stacks/node/templates/root/src/common/parseEndpoint.ts +51 -0
- package/stacks/node/templates/root/src/common/processorDlq.ts +28 -0
- package/stacks/node/templates/root/src/common/realtimeBroadcast.ts +12 -0
- package/stacks/node/templates/root/src/common/replay.ts +16 -0
- package/stacks/node/templates/root/src/common/routes.ts +19 -0
- package/stacks/node/templates/root/src/common/testHelpers.ts +44 -0
- package/stacks/node/templates/root/src/swagger.ts +34 -0
- package/stacks/node/templates/root/src/util/assertions.ts +6 -0
- package/stacks/node/templates/root/src/util/hash.ts +9 -0
- package/stacks/node/templates/root/src/util/sanitize.ts +23 -0
- package/stacks/node/templates/root/tsconfig.json +32 -0
- package/stacks/node/templates/root/vercel.json +8 -0
- package/stacks/supabase/templates/.claude/skills/build-automation/SKILL.md +266 -0
- package/stacks/supabase/templates/.claude/skills/build-state-change/SKILL.md +344 -0
- package/stacks/supabase/templates/.claude/skills/build-state-view/SKILL.md +390 -0
- package/stacks/supabase/templates/.claude/skills/build-webhook/SKILL.md +303 -0
- package/stacks/supabase/templates/.claude/skills/connect/SKILL.md +178 -0
- package/stacks/supabase/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +628 -0
- package/stacks/supabase/templates/.claude/skills/load-slice/SKILL.md +143 -0
- package/stacks/supabase/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
- package/stacks/supabase/templates/build-kit/README.md +86 -0
- package/stacks/supabase/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/supabase/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/supabase/templates/build-kit/lib/backend-prompt.md +152 -0
- package/stacks/supabase/templates/build-kit/lib/prompt.md +123 -0
- package/stacks/supabase/templates/build-kit/lib/ralph.js +369 -0
- package/stacks/supabase/templates/build-kit/ralph-claude.js +44 -0
- package/stacks/supabase/templates/build-kit/ralph.sh +98 -0
- package/stacks/supabase/templates/root/.env.example +22 -0
- package/stacks/supabase/templates/root/CLAUDE.md +61 -0
- package/stacks/supabase/templates/root/flyway.conf +17 -0
- package/stacks/supabase/templates/root/package.json +52 -0
- package/stacks/supabase/templates/root/server.ts +177 -0
- package/stacks/supabase/templates/root/setup-env.sh +53 -0
- package/stacks/supabase/templates/root/src/common/assertions.ts +6 -0
- package/stacks/supabase/templates/root/src/common/db.ts +32 -0
- package/stacks/supabase/templates/root/src/common/loadPostgresEventstore.ts +23 -0
- package/stacks/supabase/templates/root/src/common/parseEndpoint.ts +51 -0
- package/stacks/supabase/templates/root/src/common/processorDlq.ts +28 -0
- package/stacks/supabase/templates/root/src/common/realtimeBroadcast.ts +19 -0
- package/stacks/supabase/templates/root/src/common/replay.ts +16 -0
- package/stacks/supabase/templates/root/src/common/routes.ts +23 -0
- package/stacks/supabase/templates/root/src/common/testHelpers.ts +54 -0
- package/stacks/supabase/templates/root/src/supabase/README.md +141 -0
- package/stacks/supabase/templates/root/src/supabase/api.ts +56 -0
- package/stacks/supabase/templates/root/src/supabase/requireOrgaAdmin.ts +32 -0
- package/stacks/supabase/templates/root/src/supabase/requireSysUser.ts +40 -0
- package/stacks/supabase/templates/root/src/supabase/requireUser.ts +72 -0
- package/stacks/supabase/templates/root/src/swagger.ts +34 -0
- package/stacks/supabase/templates/root/src/util/assertions.ts +6 -0
- package/stacks/supabase/templates/root/src/util/hash.ts +9 -0
- package/stacks/supabase/templates/root/src/util/sanitize.ts +23 -0
- package/stacks/supabase/templates/root/supabase/config.toml +295 -0
- package/stacks/supabase/templates/root/supabase/migrations/V1__schema.sql.example +12 -0
- package/stacks/supabase/templates/root/supabase/seed.sql +1 -0
- package/stacks/supabase/templates/root/tsconfig.json +32 -0
- package/stacks/supabase/templates/root/vercel.json +8 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# ----------------------------------------------------------------------------
|
|
3
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
|
5
|
+
# distributed with this work for additional information
|
|
6
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
|
8
|
+
# "License"); you may not use this file except in compliance
|
|
9
|
+
# with the License. You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
|
14
|
+
# software distributed under the License is distributed on an
|
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
# KIND, either express or implied. See the License for the
|
|
17
|
+
# specific language governing permissions and limitations
|
|
18
|
+
# under the License.
|
|
19
|
+
# ----------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
# ----------------------------------------------------------------------------
|
|
22
|
+
# Apache Maven Wrapper startup batch script, version 3.3.2
|
|
23
|
+
#
|
|
24
|
+
# Optional ENV vars
|
|
25
|
+
# -----------------
|
|
26
|
+
# JAVA_HOME - location of a JDK home dir, required when download maven via java source
|
|
27
|
+
# MVNW_REPOURL - repo url base for downloading maven distribution
|
|
28
|
+
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
|
29
|
+
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
|
|
30
|
+
# ----------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
set -euf
|
|
33
|
+
[ "${MVNW_VERBOSE-}" != debug ] || set -x
|
|
34
|
+
|
|
35
|
+
# OS specific support.
|
|
36
|
+
native_path() { printf %s\\n "$1"; }
|
|
37
|
+
case "$(uname)" in
|
|
38
|
+
CYGWIN* | MINGW*)
|
|
39
|
+
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
|
|
40
|
+
native_path() { cygpath --path --windows "$1"; }
|
|
41
|
+
;;
|
|
42
|
+
esac
|
|
43
|
+
|
|
44
|
+
# set JAVACMD and JAVACCMD
|
|
45
|
+
set_java_home() {
|
|
46
|
+
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
|
|
47
|
+
if [ -n "${JAVA_HOME-}" ]; then
|
|
48
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
|
|
49
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
50
|
+
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
51
|
+
JAVACCMD="$JAVA_HOME/jre/sh/javac"
|
|
52
|
+
else
|
|
53
|
+
JAVACMD="$JAVA_HOME/bin/java"
|
|
54
|
+
JAVACCMD="$JAVA_HOME/bin/javac"
|
|
55
|
+
|
|
56
|
+
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
|
|
57
|
+
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
|
|
58
|
+
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
|
|
59
|
+
return 1
|
|
60
|
+
fi
|
|
61
|
+
fi
|
|
62
|
+
else
|
|
63
|
+
JAVACMD="$(
|
|
64
|
+
'set' +e
|
|
65
|
+
'unset' -f command 2>/dev/null
|
|
66
|
+
'command' -v java
|
|
67
|
+
)" || :
|
|
68
|
+
JAVACCMD="$(
|
|
69
|
+
'set' +e
|
|
70
|
+
'unset' -f command 2>/dev/null
|
|
71
|
+
'command' -v javac
|
|
72
|
+
)" || :
|
|
73
|
+
|
|
74
|
+
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
|
|
75
|
+
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
|
|
76
|
+
return 1
|
|
77
|
+
fi
|
|
78
|
+
fi
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# hash string like Java String::hashCode
|
|
82
|
+
hash_string() {
|
|
83
|
+
str="${1:-}" h=0
|
|
84
|
+
while [ -n "$str" ]; do
|
|
85
|
+
char="${str%"${str#?}"}"
|
|
86
|
+
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
|
|
87
|
+
str="${str#?}"
|
|
88
|
+
done
|
|
89
|
+
printf %x\\n $h
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
verbose() { :; }
|
|
93
|
+
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
|
|
94
|
+
|
|
95
|
+
die() {
|
|
96
|
+
printf %s\\n "$1" >&2
|
|
97
|
+
exit 1
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
trim() {
|
|
101
|
+
# MWRAPPER-139:
|
|
102
|
+
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
|
|
103
|
+
# Needed for removing poorly interpreted newline sequences when running in more
|
|
104
|
+
# exotic environments such as mingw bash on Windows.
|
|
105
|
+
printf "%s" "${1}" | tr -d '[:space:]'
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
|
|
109
|
+
while IFS="=" read -r key value; do
|
|
110
|
+
case "${key-}" in
|
|
111
|
+
distributionUrl) distributionUrl=$(trim "${value-}") ;;
|
|
112
|
+
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
|
|
113
|
+
esac
|
|
114
|
+
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
|
|
115
|
+
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
|
|
116
|
+
|
|
117
|
+
case "${distributionUrl##*/}" in
|
|
118
|
+
maven-mvnd-*bin.*)
|
|
119
|
+
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
|
|
120
|
+
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
|
|
121
|
+
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
|
|
122
|
+
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
|
|
123
|
+
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
|
|
124
|
+
:Linux*x86_64*) distributionPlatform=linux-amd64 ;;
|
|
125
|
+
*)
|
|
126
|
+
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
|
|
127
|
+
distributionPlatform=linux-amd64
|
|
128
|
+
;;
|
|
129
|
+
esac
|
|
130
|
+
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
|
|
131
|
+
;;
|
|
132
|
+
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
|
|
133
|
+
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
|
|
134
|
+
esac
|
|
135
|
+
|
|
136
|
+
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
|
137
|
+
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
|
138
|
+
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
|
|
139
|
+
distributionUrlName="${distributionUrl##*/}"
|
|
140
|
+
distributionUrlNameMain="${distributionUrlName%.*}"
|
|
141
|
+
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
|
|
142
|
+
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
|
|
143
|
+
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
|
|
144
|
+
|
|
145
|
+
exec_maven() {
|
|
146
|
+
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
|
|
147
|
+
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if [ -d "$MAVEN_HOME" ]; then
|
|
151
|
+
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
|
152
|
+
exec_maven "$@"
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
case "${distributionUrl-}" in
|
|
156
|
+
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
|
|
157
|
+
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
|
|
158
|
+
esac
|
|
159
|
+
|
|
160
|
+
# prepare tmp dir
|
|
161
|
+
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
|
|
162
|
+
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
|
|
163
|
+
trap clean HUP INT TERM EXIT
|
|
164
|
+
else
|
|
165
|
+
die "cannot create temp dir"
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
mkdir -p -- "${MAVEN_HOME%/*}"
|
|
169
|
+
|
|
170
|
+
# Download and Install Apache Maven
|
|
171
|
+
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
|
172
|
+
verbose "Downloading from: $distributionUrl"
|
|
173
|
+
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
|
174
|
+
|
|
175
|
+
# select .zip or .tar.gz
|
|
176
|
+
if ! command -v unzip >/dev/null; then
|
|
177
|
+
distributionUrl="${distributionUrl%.zip}.tar.gz"
|
|
178
|
+
distributionUrlName="${distributionUrl##*/}"
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
# verbose opt
|
|
182
|
+
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
|
|
183
|
+
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
|
|
184
|
+
|
|
185
|
+
# normalize http auth
|
|
186
|
+
case "${MVNW_PASSWORD:+has-password}" in
|
|
187
|
+
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
|
188
|
+
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
|
189
|
+
esac
|
|
190
|
+
|
|
191
|
+
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
|
|
192
|
+
verbose "Found wget ... using wget"
|
|
193
|
+
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
|
|
194
|
+
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
|
|
195
|
+
verbose "Found curl ... using curl"
|
|
196
|
+
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
|
|
197
|
+
elif set_java_home; then
|
|
198
|
+
verbose "Falling back to use Java to download"
|
|
199
|
+
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
|
|
200
|
+
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
|
|
201
|
+
cat >"$javaSource" <<-END
|
|
202
|
+
public class Downloader extends java.net.Authenticator
|
|
203
|
+
{
|
|
204
|
+
protected java.net.PasswordAuthentication getPasswordAuthentication()
|
|
205
|
+
{
|
|
206
|
+
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
|
|
207
|
+
}
|
|
208
|
+
public static void main( String[] args ) throws Exception
|
|
209
|
+
{
|
|
210
|
+
setDefault( new Downloader() );
|
|
211
|
+
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
END
|
|
215
|
+
# For Cygwin/MinGW, switch paths to Windows format before running javac and java
|
|
216
|
+
verbose " - Compiling Downloader.java ..."
|
|
217
|
+
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
|
|
218
|
+
verbose " - Running Downloader.java ..."
|
|
219
|
+
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
|
|
220
|
+
fi
|
|
221
|
+
|
|
222
|
+
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
|
223
|
+
if [ -n "${distributionSha256Sum-}" ]; then
|
|
224
|
+
distributionSha256Result=false
|
|
225
|
+
if [ "$MVN_CMD" = mvnd.sh ]; then
|
|
226
|
+
echo "Checksum validation is not supported for maven-mvnd." >&2
|
|
227
|
+
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
|
228
|
+
exit 1
|
|
229
|
+
elif command -v sha256sum >/dev/null; then
|
|
230
|
+
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
|
|
231
|
+
distributionSha256Result=true
|
|
232
|
+
fi
|
|
233
|
+
elif command -v shasum >/dev/null; then
|
|
234
|
+
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
|
|
235
|
+
distributionSha256Result=true
|
|
236
|
+
fi
|
|
237
|
+
else
|
|
238
|
+
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
|
|
239
|
+
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
|
240
|
+
exit 1
|
|
241
|
+
fi
|
|
242
|
+
if [ $distributionSha256Result = false ]; then
|
|
243
|
+
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
|
|
244
|
+
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
|
|
245
|
+
exit 1
|
|
246
|
+
fi
|
|
247
|
+
fi
|
|
248
|
+
|
|
249
|
+
# unzip and move
|
|
250
|
+
if command -v unzip >/dev/null; then
|
|
251
|
+
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
|
|
252
|
+
else
|
|
253
|
+
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
|
|
254
|
+
fi
|
|
255
|
+
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
|
|
256
|
+
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
|
|
257
|
+
|
|
258
|
+
clean || :
|
|
259
|
+
exec_maven "$@"
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<# : batch portion
|
|
2
|
+
@REM ----------------------------------------------------------------------------
|
|
3
|
+
@REM Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
@REM or more contributor license agreements. See the NOTICE file
|
|
5
|
+
@REM distributed with this work for additional information
|
|
6
|
+
@REM regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
@REM to you under the Apache License, Version 2.0 (the
|
|
8
|
+
@REM "License"); you may not use this file except in compliance
|
|
9
|
+
@REM with the License. You may obtain a copy of the License at
|
|
10
|
+
@REM
|
|
11
|
+
@REM http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
@REM
|
|
13
|
+
@REM Unless required by applicable law or agreed to in writing,
|
|
14
|
+
@REM software distributed under the License is distributed on an
|
|
15
|
+
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
@REM KIND, either express or implied. See the License for the
|
|
17
|
+
@REM specific language governing permissions and limitations
|
|
18
|
+
@REM under the License.
|
|
19
|
+
@REM ----------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
@REM ----------------------------------------------------------------------------
|
|
22
|
+
@REM Apache Maven Wrapper startup batch script, version 3.3.2
|
|
23
|
+
@REM
|
|
24
|
+
@REM Optional ENV vars
|
|
25
|
+
@REM MVNW_REPOURL - repo url base for downloading maven distribution
|
|
26
|
+
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
|
27
|
+
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
|
|
28
|
+
@REM ----------------------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
|
|
31
|
+
@SET __MVNW_CMD__=
|
|
32
|
+
@SET __MVNW_ERROR__=
|
|
33
|
+
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
|
|
34
|
+
@SET PSModulePath=
|
|
35
|
+
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
|
|
36
|
+
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
|
|
37
|
+
)
|
|
38
|
+
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
|
|
39
|
+
@SET __MVNW_PSMODULEP_SAVE=
|
|
40
|
+
@SET __MVNW_ARG0_NAME__=
|
|
41
|
+
@SET MVNW_USERNAME=
|
|
42
|
+
@SET MVNW_PASSWORD=
|
|
43
|
+
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
|
|
44
|
+
@echo Cannot start maven from wrapper >&2 && exit /b 1
|
|
45
|
+
@GOTO :EOF
|
|
46
|
+
: end batch / begin powershell #>
|
|
47
|
+
|
|
48
|
+
$ErrorActionPreference = "Stop"
|
|
49
|
+
if ($env:MVNW_VERBOSE -eq "true") {
|
|
50
|
+
$VerbosePreference = "Continue"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
|
|
54
|
+
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
|
|
55
|
+
if (!$distributionUrl) {
|
|
56
|
+
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
|
|
60
|
+
"maven-mvnd-*" {
|
|
61
|
+
$USE_MVND = $true
|
|
62
|
+
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
|
|
63
|
+
$MVN_CMD = "mvnd.cmd"
|
|
64
|
+
break
|
|
65
|
+
}
|
|
66
|
+
default {
|
|
67
|
+
$USE_MVND = $false
|
|
68
|
+
$MVN_CMD = $script -replace '^mvnw','mvn'
|
|
69
|
+
break
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
|
74
|
+
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
|
75
|
+
if ($env:MVNW_REPOURL) {
|
|
76
|
+
$MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
|
|
77
|
+
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
|
|
78
|
+
}
|
|
79
|
+
$distributionUrlName = $distributionUrl -replace '^.*/',''
|
|
80
|
+
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
|
|
81
|
+
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
|
|
82
|
+
if ($env:MAVEN_USER_HOME) {
|
|
83
|
+
$MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain"
|
|
84
|
+
}
|
|
85
|
+
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
|
|
86
|
+
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
|
|
87
|
+
|
|
88
|
+
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
|
|
89
|
+
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
|
90
|
+
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
|
|
91
|
+
exit $?
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
|
|
95
|
+
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
# prepare tmp dir
|
|
99
|
+
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
|
|
100
|
+
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
|
|
101
|
+
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
|
|
102
|
+
trap {
|
|
103
|
+
if ($TMP_DOWNLOAD_DIR.Exists) {
|
|
104
|
+
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
|
|
105
|
+
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
|
|
110
|
+
|
|
111
|
+
# Download and Install Apache Maven
|
|
112
|
+
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
|
113
|
+
Write-Verbose "Downloading from: $distributionUrl"
|
|
114
|
+
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
|
115
|
+
|
|
116
|
+
$webclient = New-Object System.Net.WebClient
|
|
117
|
+
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
|
|
118
|
+
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
|
|
119
|
+
}
|
|
120
|
+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
121
|
+
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
|
|
122
|
+
|
|
123
|
+
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
|
124
|
+
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
|
|
125
|
+
if ($distributionSha256Sum) {
|
|
126
|
+
if ($USE_MVND) {
|
|
127
|
+
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
|
|
128
|
+
}
|
|
129
|
+
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
|
|
130
|
+
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
|
|
131
|
+
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
# unzip and move
|
|
136
|
+
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
|
|
137
|
+
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
|
|
138
|
+
try {
|
|
139
|
+
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
|
|
140
|
+
} catch {
|
|
141
|
+
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
|
|
142
|
+
Write-Error "fail to move MAVEN_HOME"
|
|
143
|
+
}
|
|
144
|
+
} finally {
|
|
145
|
+
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
|
|
146
|
+
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
3
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
4
|
+
<modelVersion>4.0.0</modelVersion>
|
|
5
|
+
<groupId>io.axoniq.quickstart</groupId>
|
|
6
|
+
<artifactId>quickstart</artifactId>
|
|
7
|
+
<name>Axoniq Platform Quickstart</name>
|
|
8
|
+
<version>0.0.1-SNAPSHOT</version>
|
|
9
|
+
|
|
10
|
+
<properties>
|
|
11
|
+
<java.version>21</java.version>
|
|
12
|
+
<axoniq-framework.version>5.1.1</axoniq-framework.version>
|
|
13
|
+
<axoniq-platform-client.version>5.1.0</axoniq-platform-client.version>
|
|
14
|
+
<spring-boot.version>4.0.6</spring-boot.version>
|
|
15
|
+
</properties>
|
|
16
|
+
|
|
17
|
+
<dependencies>
|
|
18
|
+
<dependency>
|
|
19
|
+
<groupId>org.springframework.boot</groupId>
|
|
20
|
+
<artifactId>spring-boot-starter-webflux</artifactId>
|
|
21
|
+
</dependency>
|
|
22
|
+
|
|
23
|
+
<!-- Read model persistence: Spring Data JPA + PostgreSQL, default for all projections -->
|
|
24
|
+
<dependency>
|
|
25
|
+
<groupId>org.springframework.boot</groupId>
|
|
26
|
+
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
|
27
|
+
</dependency>
|
|
28
|
+
<dependency>
|
|
29
|
+
<groupId>org.postgresql</groupId>
|
|
30
|
+
<artifactId>postgresql</artifactId>
|
|
31
|
+
<scope>runtime</scope>
|
|
32
|
+
</dependency>
|
|
33
|
+
|
|
34
|
+
<!-- Axoniq Framework: core + Axon Server connector, wired up for Spring Boot -->
|
|
35
|
+
<dependency>
|
|
36
|
+
<groupId>io.axoniq.framework</groupId>
|
|
37
|
+
<artifactId>axoniq-spring-boot-starter</artifactId>
|
|
38
|
+
</dependency>
|
|
39
|
+
|
|
40
|
+
<!-- Axoniq Platform client: live metrics, processor controls, DLQ inspection -->
|
|
41
|
+
<dependency>
|
|
42
|
+
<groupId>io.axoniq.platform</groupId>
|
|
43
|
+
<artifactId>axoniq-platform-spring-boot-starter</artifactId>
|
|
44
|
+
</dependency>
|
|
45
|
+
|
|
46
|
+
<!-- Testing -->
|
|
47
|
+
<dependency>
|
|
48
|
+
<groupId>org.springframework.boot</groupId>
|
|
49
|
+
<artifactId>spring-boot-starter-test</artifactId>
|
|
50
|
+
<scope>test</scope>
|
|
51
|
+
</dependency>
|
|
52
|
+
<dependency>
|
|
53
|
+
<groupId>org.junit.jupiter</groupId>
|
|
54
|
+
<artifactId>junit-jupiter</artifactId>
|
|
55
|
+
<scope>test</scope>
|
|
56
|
+
</dependency>
|
|
57
|
+
<dependency>
|
|
58
|
+
<groupId>org.springframework.boot</groupId>
|
|
59
|
+
<artifactId>spring-boot-testcontainers</artifactId>
|
|
60
|
+
<scope>test</scope>
|
|
61
|
+
</dependency>
|
|
62
|
+
<dependency>
|
|
63
|
+
<groupId>org.testcontainers</groupId>
|
|
64
|
+
<artifactId>testcontainers-postgresql</artifactId>
|
|
65
|
+
<scope>test</scope>
|
|
66
|
+
</dependency>
|
|
67
|
+
<dependency>
|
|
68
|
+
<groupId>org.testcontainers</groupId>
|
|
69
|
+
<artifactId>testcontainers-junit-jupiter</artifactId>
|
|
70
|
+
<scope>test</scope>
|
|
71
|
+
</dependency>
|
|
72
|
+
<dependency>
|
|
73
|
+
<groupId>org.springframework.boot</groupId>
|
|
74
|
+
<artifactId>spring-boot-data-jpa-test</artifactId>
|
|
75
|
+
<scope>test</scope>
|
|
76
|
+
</dependency>
|
|
77
|
+
<dependency>
|
|
78
|
+
<groupId>org.springframework.boot</groupId>
|
|
79
|
+
<artifactId>spring-boot-jdbc-test</artifactId>
|
|
80
|
+
<scope>test</scope>
|
|
81
|
+
</dependency>
|
|
82
|
+
</dependencies>
|
|
83
|
+
|
|
84
|
+
<build>
|
|
85
|
+
<plugins>
|
|
86
|
+
<plugin>
|
|
87
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
88
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
|
89
|
+
<configuration>
|
|
90
|
+
<source>${java.version}</source>
|
|
91
|
+
<target>${java.version}</target>
|
|
92
|
+
<parameters>true</parameters>
|
|
93
|
+
</configuration>
|
|
94
|
+
</plugin>
|
|
95
|
+
<plugin>
|
|
96
|
+
<groupId>org.springframework.boot</groupId>
|
|
97
|
+
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
98
|
+
</plugin>
|
|
99
|
+
</plugins>
|
|
100
|
+
</build>
|
|
101
|
+
|
|
102
|
+
<dependencyManagement>
|
|
103
|
+
<dependencies>
|
|
104
|
+
<dependency>
|
|
105
|
+
<groupId>org.springframework.boot</groupId>
|
|
106
|
+
<artifactId>spring-boot-dependencies</artifactId>
|
|
107
|
+
<version>${spring-boot.version}</version>
|
|
108
|
+
<type>pom</type>
|
|
109
|
+
<scope>import</scope>
|
|
110
|
+
</dependency>
|
|
111
|
+
<dependency>
|
|
112
|
+
<groupId>io.axoniq.framework</groupId>
|
|
113
|
+
<artifactId>axoniq-framework-bom</artifactId>
|
|
114
|
+
<version>${axoniq-framework.version}</version>
|
|
115
|
+
<type>pom</type>
|
|
116
|
+
<scope>import</scope>
|
|
117
|
+
</dependency>
|
|
118
|
+
<dependency>
|
|
119
|
+
<groupId>io.axoniq.platform</groupId>
|
|
120
|
+
<artifactId>axoniq-platform-spring-boot-starter</artifactId>
|
|
121
|
+
<version>${axoniq-platform-client.version}</version>
|
|
122
|
+
</dependency>
|
|
123
|
+
</dependencies>
|
|
124
|
+
</dependencyManagement>
|
|
125
|
+
</project>
|
package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/QuickstartApplication.java
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
package io.axoniq.quickstart;
|
|
2
|
+
|
|
3
|
+
import io.axoniq.quickstart.giftcard.domain.GiftCard;
|
|
4
|
+
import org.axonframework.messaging.eventhandling.processing.streaming.token.store.TokenStore;
|
|
5
|
+
import org.axonframework.messaging.eventhandling.processing.streaming.token.store.inmemory.InMemoryTokenStore;
|
|
6
|
+
import org.springframework.boot.SpringApplication;
|
|
7
|
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
8
|
+
import org.springframework.context.annotation.Bean;
|
|
9
|
+
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Main entry point for the Axoniq Platform Quickstart application.
|
|
13
|
+
*
|
|
14
|
+
* <p>This Spring Boot application demonstrates a complete CQRS/Event Sourcing implementation
|
|
15
|
+
* using Axon Framework and Axon Server, showcasing best practices for building reactive,
|
|
16
|
+
* scalable applications with event-driven architecture.</p>
|
|
17
|
+
*
|
|
18
|
+
* <p><strong>Architecture Overview:</strong></p>
|
|
19
|
+
* <ul>
|
|
20
|
+
* <li><strong>CQRS Implementation</strong>: Separates command and query responsibilities</li>
|
|
21
|
+
* <li><strong>Event Sourcing</strong>: Stores state changes as immutable events</li>
|
|
22
|
+
* <li><strong>Reactive Web Stack</strong>: Uses Spring WebFlux for non-blocking I/O</li>
|
|
23
|
+
* <li><strong>Real-time Updates</strong>: Implements Server-Sent Events for live UI updates</li>
|
|
24
|
+
* <li><strong>In-Memory Projections</strong>: Fast query performance with eventual consistency</li>
|
|
25
|
+
* </ul>
|
|
26
|
+
*
|
|
27
|
+
* <p><strong>Key Components Enabled:</strong></p>
|
|
28
|
+
* <ul>
|
|
29
|
+
* <li><strong>{@code @SpringBootApplication}</strong>: Enables auto-configuration, component scanning, and configuration properties</li>
|
|
30
|
+
* <li><strong>{@code @EnableScheduling}</strong>: Activates scheduled task execution for the {@link io.axoniq.quickstart.giftcard.scheduler.GiftCardScheduler}</li>
|
|
31
|
+
* </ul>
|
|
32
|
+
*
|
|
33
|
+
* <p><strong>Domain Model:</strong></p>
|
|
34
|
+
* <p>The application centers around a Gift Card domain implementing:</p>
|
|
35
|
+
* <ul>
|
|
36
|
+
* <li><strong>EventSourced DCB Model</strong>: {@link GiftCard} - Core business logic and state</li>
|
|
37
|
+
* <li><strong>Commands</strong>: Issue and redeem operations with business validation</li>
|
|
38
|
+
* <li><strong>Events</strong>: Immutable facts about gift card lifecycle changes</li>
|
|
39
|
+
* <li><strong>Queries</strong>: Read operations with subscription query support</li>
|
|
40
|
+
* <li><strong>Projections</strong>: Denormalized read models for efficient querying</li>
|
|
41
|
+
* </ul>
|
|
42
|
+
*
|
|
43
|
+
* <p><strong>Technical Stack:</strong></p>
|
|
44
|
+
* <ul>
|
|
45
|
+
* <li><strong>Axon Framework</strong>: CQRS/Event Sourcing framework</li>
|
|
46
|
+
* <li><strong>Axon Server</strong>: Event store and message routing infrastructure</li>
|
|
47
|
+
* <li><strong>Spring WebFlux</strong>: Reactive web framework with non-blocking I/O</li>
|
|
48
|
+
* <li><strong>Vue.js 3</strong>: Frontend framework with Vuetify UI components</li>
|
|
49
|
+
* <li><strong>Server-Sent Events</strong>: Real-time updates without WebSocket complexity</li>
|
|
50
|
+
* </ul>
|
|
51
|
+
*
|
|
52
|
+
* <p><strong>Educational Value:</strong></p>
|
|
53
|
+
* <p>This quickstart serves as a practical learning resource demonstrating:</p>
|
|
54
|
+
* <ul>
|
|
55
|
+
* <li>Event Sourcing patterns and practices</li>
|
|
56
|
+
* <li>CQRS implementation with separate read/write models</li>
|
|
57
|
+
* <li>Real-time web applications with reactive streams</li>
|
|
58
|
+
* <li>Integration between Axon Framework and Spring Boot</li>
|
|
59
|
+
* <li>Modern UI development with real-time data updates</li>
|
|
60
|
+
* </ul>
|
|
61
|
+
*
|
|
62
|
+
* <p><strong>Production Readiness Notes:</strong></p>
|
|
63
|
+
* <p>While this quickstart demonstrates core patterns, production deployments should consider:</p>
|
|
64
|
+
* <ul>
|
|
65
|
+
* <li>Persistent event store configuration (vs. in-memory)</li>
|
|
66
|
+
* <li>Distributed deployment strategies</li>
|
|
67
|
+
* <li>Monitoring and observability integration</li>
|
|
68
|
+
* <li>Security implementation (authentication, authorization)</li>
|
|
69
|
+
* <li>Error handling and retry mechanisms</li>
|
|
70
|
+
* <li>Performance tuning and resource optimization</li>
|
|
71
|
+
* </ul>
|
|
72
|
+
*
|
|
73
|
+
* <p><strong>Getting Started:</strong></p>
|
|
74
|
+
* <ol>
|
|
75
|
+
* <li>Ensure Axon Server is running on localhost:8124</li>
|
|
76
|
+
* <li>Run this application using Spring Boot</li>
|
|
77
|
+
* <li>Access the web interface at http://localhost:8080</li>
|
|
78
|
+
* <li>Observe real-time gift card operations via the scheduler</li>
|
|
79
|
+
* <li>Interact with the API endpoints at /api/giftcards</li>
|
|
80
|
+
* </ol>
|
|
81
|
+
*
|
|
82
|
+
* @see GiftCard
|
|
83
|
+
* @see io.axoniq.quickstart.giftcard.web.GiftCardController
|
|
84
|
+
* @see io.axoniq.quickstart.giftcard.query.GiftCardProjection
|
|
85
|
+
* @see io.axoniq.quickstart.giftcard.scheduler.GiftCardScheduler
|
|
86
|
+
* @see <a href="https://docs.axoniq.io/reference-guide/">Axon Framework Reference Guide</a>
|
|
87
|
+
*
|
|
88
|
+
* @author AxonIQ Quickstart
|
|
89
|
+
* @version 1.0
|
|
90
|
+
* @since 1.0
|
|
91
|
+
*/
|
|
92
|
+
@SpringBootApplication
|
|
93
|
+
@EnableScheduling
|
|
94
|
+
public class QuickstartApplication {
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Application entry point that starts the Spring Boot application.
|
|
98
|
+
*
|
|
99
|
+
* <p>This method bootstraps the entire application context, including:</p>
|
|
100
|
+
* <ul>
|
|
101
|
+
* <li>Axon Framework auto-configuration</li>
|
|
102
|
+
* <li>Spring WebFlux reactive web server</li>
|
|
103
|
+
* <li>Component scanning and dependency injection</li>
|
|
104
|
+
* <li>Scheduled task initialization</li>
|
|
105
|
+
* <li>Static resource serving configuration</li>
|
|
106
|
+
* </ul>
|
|
107
|
+
*
|
|
108
|
+
* <p><strong>Startup sequence:</strong></p>
|
|
109
|
+
* <ol>
|
|
110
|
+
* <li>Spring Boot application context initialization</li>
|
|
111
|
+
* <li>Axon Server connection establishment</li>
|
|
112
|
+
* <li>Event store and command/query bus configuration</li>
|
|
113
|
+
* <li>EventSourced DCB model and projection registration</li>
|
|
114
|
+
* <li>Web server startup on port 8080</li>
|
|
115
|
+
* <li>Scheduler activation for demo operations</li>
|
|
116
|
+
* </ol>
|
|
117
|
+
*
|
|
118
|
+
* @param args command line arguments passed to the application
|
|
119
|
+
*/
|
|
120
|
+
public static void main(String[] args) {
|
|
121
|
+
SpringApplication.run(QuickstartApplication.class, args);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@Bean
|
|
125
|
+
public TokenStore tokenStore() {
|
|
126
|
+
return new InMemoryTokenStore();
|
|
127
|
+
}
|
|
128
|
+
}
|