gridjs-spreadsheet 24.11.1 → 25.1.0

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.
Files changed (48) hide show
  1. package/example/.classpath +41 -0
  2. package/example/.project +23 -0
  3. package/example/Dockerfile +53 -0
  4. package/example/HELP.md +34 -0
  5. package/example/README.md +35 -0
  6. package/example/compose.yaml +1 -0
  7. package/example/mvnw +250 -0
  8. package/example/mvnw.cmd +146 -0
  9. package/example/pom.xml +118 -0
  10. package/example/src/main/java/com/aspose/gridjs/demo/GridjsdemoApplication.java +91 -0
  11. package/example/src/main/java/com/aspose/gridjs/demo/LocalFileCache.java +92 -0
  12. package/example/src/main/java/com/aspose/gridjs/demo/ModifyMonitor.java +21 -0
  13. package/example/src/main/java/com/aspose/gridjs/demo/controller/DataController.java +128 -0
  14. package/example/src/main/java/com/aspose/gridjs/demo/controller/GridJs2Controller.java +558 -0
  15. package/example/src/main/resources/application.properties +17 -0
  16. package/example/src/main/resources/static/xspread/555f60323063f2b68b6eac7ce9c45b19.svg +88 -0
  17. package/example/src/main/resources/static/xspread/a3b683289420fd8ec937908397907279.svg +907 -0
  18. package/example/src/main/resources/static/xspread/bootstrap.min.22.5.5.2.css +1 -0
  19. package/example/src/main/resources/static/xspread/content/img/20130527034914143.gif +0 -0
  20. package/example/src/main/resources/static/xspread/content/img/20130527034914229.gif +0 -0
  21. package/example/src/main/resources/static/xspread/content/img/20130527034916363.gif +0 -0
  22. package/example/src/main/resources/static/xspread/content/img/20130527034917946.gif +0 -0
  23. package/example/src/main/resources/static/xspread/content/img/20130527034918372.gif +0 -0
  24. package/example/src/main/resources/static/xspread/content/img/loading.gif +0 -0
  25. package/example/src/main/resources/static/xspread/content/img/testupdating.gif +0 -0
  26. package/example/src/main/resources/static/xspread/content/img/testupdating1.png +0 -0
  27. package/example/src/main/resources/static/xspread/content/img/updating.gif +0 -0
  28. package/example/src/main/resources/static/xspread/jquery-2.1.1.js +9190 -0
  29. package/example/src/main/resources/static/xspread/jquery-ui.min.css +7 -0
  30. package/example/src/main/resources/static/xspread/jquery-ui.min.js +6 -0
  31. package/example/src/main/resources/static/xspread/jszip.min.js +13 -0
  32. package/example/src/main/resources/static/xspread/xspreadsheet.css +1953 -0
  33. package/example/src/main/resources/static/xspread/xspreadsheet.js +21 -0
  34. package/example/src/main/resources/templates/fileFromUpload.html +297 -0
  35. package/example/src/main/resources/templates/index.html +296 -0
  36. package/example/src/main/resources/templates/list.html +98 -0
  37. package/example/wb/Sales Report.xlsx +0 -0
  38. package/example/wb/SampleFile2.xlsx +0 -0
  39. package/example/wb/TextBoxExample.xlsx +0 -0
  40. package/example/wb/chart.xlsx +0 -0
  41. package/example/wb/controls.xlsx +0 -0
  42. package/example/wb/studenttop.xlsx +0 -0
  43. package/example/wb/to-do-list.xlsx +0 -0
  44. package/package.json +1 -1
  45. package/preview.gif +0 -0
  46. package/readme.md +42 -8
  47. package/xspreadsheet.css +24 -0
  48. package/xspreadsheet.js +5 -5
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <classpath>
3
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
4
+ <attributes>
5
+ <attribute name="optional" value="true"/>
6
+ <attribute name="maven.pomderived" value="true"/>
7
+ </attributes>
8
+ </classpathentry>
9
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10
+ <attributes>
11
+ <attribute name="maven.pomderived" value="true"/>
12
+ <attribute name="optional" value="true"/>
13
+ </attributes>
14
+ </classpathentry>
15
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
16
+ <attributes>
17
+ <attribute name="test" value="true"/>
18
+ <attribute name="optional" value="true"/>
19
+ <attribute name="maven.pomderived" value="true"/>
20
+ </attributes>
21
+ </classpathentry>
22
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
23
+ <attributes>
24
+ <attribute name="test" value="true"/>
25
+ <attribute name="maven.pomderived" value="true"/>
26
+ <attribute name="optional" value="true"/>
27
+ </attributes>
28
+ </classpathentry>
29
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
30
+ <attributes>
31
+ <attribute name="module" value="true"/>
32
+ <attribute name="maven.pomderived" value="true"/>
33
+ </attributes>
34
+ </classpathentry>
35
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
36
+ <attributes>
37
+ <attribute name="maven.pomderived" value="true"/>
38
+ </attributes>
39
+ </classpathentry>
40
+ <classpathentry kind="output" path="target/classes"/>
41
+ </classpath>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>Examples.GridJs</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.eclipse.jdt.core.javabuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ <buildCommand>
14
+ <name>org.eclipse.m2e.core.maven2Builder</name>
15
+ <arguments>
16
+ </arguments>
17
+ </buildCommand>
18
+ </buildSpec>
19
+ <natures>
20
+ <nature>org.eclipse.jdt.core.javanature</nature>
21
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
22
+ </natures>
23
+ </projectDescription>
@@ -0,0 +1,53 @@
1
+
2
+
3
+ # FROM mcr.microsoft.com/java/openjdk:11 AS build
4
+ FROM eclipse/ubuntu_jdk8
5
+
6
+ # ���ù���Ŀ¼
7
+ WORKDIR /usr/src/app
8
+
9
+
10
+
11
+
12
+ # �����ص� Maven �����ļ��ͻ������������ļ����Ƶ�������
13
+ COPY mvnw .
14
+ COPY .mvn .mvn
15
+ COPY pom.xml .
16
+ COPY src src
17
+
18
+ # ʹ�� Maven ����Ӧ�ã�������ʹ�õ��� Maven��
19
+ RUN ./mvnw package -DskipTests
20
+
21
+
22
+
23
+
24
+
25
+ # Set the user
26
+ USER root
27
+
28
+ RUN ls -l *
29
+
30
+ # �������� jar �ļ����Ƶ��µ�������
31
+ COPY target/*.jar /app/app.jar
32
+
33
+ # ɾ��������Ҫ��Դ��� Maven ���棬���پ������
34
+ RUN rm -rf target && rm -rf .mvn && rm -rf src
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+ # web port
44
+ EXPOSE 8080
45
+ # Install Fonts because the SDK image contains very few fonts. The command copies font files from local to docker image. Make sure you have a local ��fonts�� directory that contains all the fonts you need to install. In this example, the local ��fonts�� directory is put in the same directory as the Dockerfile.
46
+ # COPY fonts/* /usr/share/fonts/
47
+ RUN mkdir -p /app/wb
48
+ RUN mkdir -p /app/grid_cache/streamcache
49
+ RUN mkdir -p /app/upload
50
+ COPY wb/*.xlsx /app/wb/
51
+ # RUN ls -l /app/
52
+
53
+ ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app/app.jar"]
@@ -0,0 +1,34 @@
1
+ # Read Me First
2
+ The following was discovered as part of building this project:
3
+
4
+ * No Docker Compose services found. As of now, the application won't start! Please add at least one service to the `compose.yaml` file.
5
+
6
+ # Getting Started
7
+
8
+ ### Reference Documentation
9
+ For further reference, please consider the following sections:
10
+
11
+ * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
12
+ * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.3.0/maven-plugin/reference/html/)
13
+ * [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.3.0/maven-plugin/reference/html/#build-image)
14
+ * [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/3.3.0/reference/htmlsingle/index.html#using.devtools)
15
+ * [Docker Compose Support](https://docs.spring.io/spring-boot/docs/3.3.0/reference/htmlsingle/index.html#features.docker-compose)
16
+ * [Spring Web](https://docs.spring.io/spring-boot/docs/3.3.0/reference/htmlsingle/index.html#web)
17
+ * [Thymeleaf](https://docs.spring.io/spring-boot/docs/3.3.0/reference/htmlsingle/index.html#web.servlet.spring-mvc.template-engines)
18
+ * [Apache Freemarker](https://docs.spring.io/spring-boot/docs/3.3.0/reference/htmlsingle/index.html#web.servlet.spring-mvc.template-engines)
19
+
20
+ ### Guides
21
+ The following guides illustrate how to use some features concretely:
22
+
23
+ * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
24
+ * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
25
+ * [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
26
+ * [Handling Form Submission](https://spring.io/guides/gs/handling-form-submission/)
27
+
28
+ ### Docker Compose support
29
+ This project contains a Docker Compose file named `compose.yaml`.
30
+
31
+ However, no services were found. As of now, the application won't start!
32
+
33
+ Please make sure to add at least one service in the `compose.yaml` file.
34
+
@@ -0,0 +1,35 @@
1
+ # Aspose.Cells.GridJs Java Demo
2
+ [Aspose.Cells.GridJs for Java](http://www.aspose.com/products/cells/java) is a lightweight, scalable, and customizable toolkit that provides cross-platform web applications, enables convenient development for editing or viewing Excel/Spreadsheet files, offers simple deployment, and provides easy-to-use APIs.
3
+
4
+ ## How to Run the Examples
5
+ 1.edit the properties in src\main\resources\application.properties
6
+
7
+ #This is the excel directory to browse
8
+ testconfig.ListDir=/app/wb
9
+
10
+ #Specific the spreadsheet file name in the directory to browse
11
+ testconfig.FileName=chart.xlsx
12
+
13
+ #Directory for storing cache files
14
+ testconfig.CachePath=/app/grid_cache
15
+
16
+ 2.run src\main\java\com\aspose\gridjs\demo\GridjsdemoApplication.java
17
+
18
+ open browser and navigate to http://localhost:8080/gridjsdemo/index
19
+
20
+ ## Step to run in docker
21
+
22
+ docker build -t gridjs-demo-java .
23
+
24
+ docker run -d -p 8080:8080 gridjs-demo-java
25
+
26
+ open browser and enter the url:http://localhost:8080/gridjsdemo/index
27
+
28
+ ## Resources
29
+
30
+ + **Website:** [www.aspose.com](http://www.aspose.com)
31
+ + **Product Home:** [Aspose.Cells for Java](http://www.aspose.com/products/cells/java)
32
+ + **Download:** [Download Aspose.Cells for Java](https://downloads.aspose.com/cells/java)
33
+ + **Documentation:** [Aspose.Cells for Java Documentation](https://docs.aspose.com/display/cellsjava/Home)
34
+ + **Forum:** [Aspose.Cells for Java Forum](http://www.aspose.com/community/forums/aspose.cells-product-family/19/showforum.aspx)
35
+ + **Blog:** [Aspose.Cells for Java Blog](https://blog.aspose.com/category/aspose-products/aspose-cells-product-family/)
@@ -0,0 +1 @@
1
+ services:
package/example/mvnw ADDED
@@ -0,0 +1,250 @@
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
+ # https://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.1
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
+ # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
101
+ while IFS="=" read -r key value; do
102
+ case "${key-}" in
103
+ distributionUrl) distributionUrl="${value-}" ;;
104
+ distributionSha256Sum) distributionSha256Sum="${value-}" ;;
105
+ esac
106
+ done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
107
+ [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
108
+
109
+ case "${distributionUrl##*/}" in
110
+ maven-mvnd-*bin.*)
111
+ MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
112
+ case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
113
+ *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
114
+ :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
115
+ :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
116
+ :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
117
+ *)
118
+ echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
119
+ distributionPlatform=linux-amd64
120
+ ;;
121
+ esac
122
+ distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
123
+ ;;
124
+ maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
125
+ *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
126
+ esac
127
+
128
+ # apply MVNW_REPOURL and calculate MAVEN_HOME
129
+ # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
130
+ [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
131
+ distributionUrlName="${distributionUrl##*/}"
132
+ distributionUrlNameMain="${distributionUrlName%.*}"
133
+ distributionUrlNameMain="${distributionUrlNameMain%-bin}"
134
+ MAVEN_HOME="$HOME/.m2/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
135
+
136
+ exec_maven() {
137
+ unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
138
+ exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
139
+ }
140
+
141
+ if [ -d "$MAVEN_HOME" ]; then
142
+ verbose "found existing MAVEN_HOME at $MAVEN_HOME"
143
+ exec_maven "$@"
144
+ fi
145
+
146
+ case "${distributionUrl-}" in
147
+ *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
148
+ *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
149
+ esac
150
+
151
+ # prepare tmp dir
152
+ if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
153
+ clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
154
+ trap clean HUP INT TERM EXIT
155
+ else
156
+ die "cannot create temp dir"
157
+ fi
158
+
159
+ mkdir -p -- "${MAVEN_HOME%/*}"
160
+
161
+ # Download and Install Apache Maven
162
+ verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
163
+ verbose "Downloading from: $distributionUrl"
164
+ verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
165
+
166
+ # select .zip or .tar.gz
167
+ if ! command -v unzip >/dev/null; then
168
+ distributionUrl="${distributionUrl%.zip}.tar.gz"
169
+ distributionUrlName="${distributionUrl##*/}"
170
+ fi
171
+
172
+ # verbose opt
173
+ __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
174
+ [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
175
+
176
+ # normalize http auth
177
+ case "${MVNW_PASSWORD:+has-password}" in
178
+ '') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
179
+ has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
180
+ esac
181
+
182
+ if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
183
+ verbose "Found wget ... using wget"
184
+ wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
185
+ elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
186
+ verbose "Found curl ... using curl"
187
+ curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
188
+ elif set_java_home; then
189
+ verbose "Falling back to use Java to download"
190
+ javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
191
+ targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
192
+ cat >"$javaSource" <<-END
193
+ public class Downloader extends java.net.Authenticator
194
+ {
195
+ protected java.net.PasswordAuthentication getPasswordAuthentication()
196
+ {
197
+ return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
198
+ }
199
+ public static void main( String[] args ) throws Exception
200
+ {
201
+ setDefault( new Downloader() );
202
+ java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
203
+ }
204
+ }
205
+ END
206
+ # For Cygwin/MinGW, switch paths to Windows format before running javac and java
207
+ verbose " - Compiling Downloader.java ..."
208
+ "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
209
+ verbose " - Running Downloader.java ..."
210
+ "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
211
+ fi
212
+
213
+ # If specified, validate the SHA-256 sum of the Maven distribution zip file
214
+ if [ -n "${distributionSha256Sum-}" ]; then
215
+ distributionSha256Result=false
216
+ if [ "$MVN_CMD" = mvnd.sh ]; then
217
+ echo "Checksum validation is not supported for maven-mvnd." >&2
218
+ echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
219
+ exit 1
220
+ elif command -v sha256sum >/dev/null; then
221
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
222
+ distributionSha256Result=true
223
+ fi
224
+ elif command -v shasum >/dev/null; then
225
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
226
+ distributionSha256Result=true
227
+ fi
228
+ else
229
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
230
+ echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
231
+ exit 1
232
+ fi
233
+ if [ $distributionSha256Result = false ]; then
234
+ echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
235
+ echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
236
+ exit 1
237
+ fi
238
+ fi
239
+
240
+ # unzip and move
241
+ if command -v unzip >/dev/null; then
242
+ unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
243
+ else
244
+ tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
245
+ fi
246
+ printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
247
+ mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
248
+
249
+ clean || :
250
+ exec_maven "$@"
@@ -0,0 +1,146 @@
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 https://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.1
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
+ $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
83
+ $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
84
+
85
+ if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
86
+ Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
87
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
88
+ exit $?
89
+ }
90
+
91
+ if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
92
+ Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
93
+ }
94
+
95
+ # prepare tmp dir
96
+ $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
97
+ $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
98
+ $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
99
+ trap {
100
+ if ($TMP_DOWNLOAD_DIR.Exists) {
101
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
102
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
103
+ }
104
+ }
105
+
106
+ New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
107
+
108
+ # Download and Install Apache Maven
109
+ Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
110
+ Write-Verbose "Downloading from: $distributionUrl"
111
+ Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
112
+
113
+ $webclient = New-Object System.Net.WebClient
114
+ if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
115
+ $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
116
+ }
117
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
118
+ $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
119
+
120
+ # If specified, validate the SHA-256 sum of the Maven distribution zip file
121
+ $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
122
+ if ($distributionSha256Sum) {
123
+ if ($USE_MVND) {
124
+ Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
125
+ }
126
+ Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
127
+ if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
128
+ 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."
129
+ }
130
+ }
131
+
132
+ # unzip and move
133
+ Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
134
+ Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
135
+ try {
136
+ Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
137
+ } catch {
138
+ if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
139
+ Write-Error "fail to move MAVEN_HOME"
140
+ }
141
+ } finally {
142
+ try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
143
+ catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
144
+ }
145
+
146
+ Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"