Skip to content

Commit d68c78d

Browse files
committed
Initial commit
0 parents  commit d68c78d

File tree

6 files changed

+556
-0
lines changed

6 files changed

+556
-0
lines changed

.github/workflows/ant.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This workflow will build a Java project with Ant
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-ant
3+
4+
name: Java CI
5+
6+
on:
7+
# push:
8+
# branches: [ "main" ]
9+
# pull_request:
10+
# branches: [ "main" ]
11+
workflow_dispatch:
12+
push:
13+
tags:
14+
- "v*.*.*"
15+
jobs:
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up JDK 21
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: '21'
26+
distribution: 'temurin'
27+
- name: Get version
28+
id: get_version
29+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
30+
31+
- name: Test version
32+
run: |
33+
echo ${{ steps.get_version.outputs.VERSION }}
34+
echo ${{ github.ref }}
35+
36+
- name: Build with Ant
37+
run: |
38+
ant -noinput -buildfile build.xml
39+
sha256sum src/main/java/JvmOptionsParser.java > JvmOptionsParser.java.sha256sum
40+
sha256sum dist/JvmOptionsParser.jar > JvmOptionsParser.jar.sha256sum
41+
- name: Release
42+
uses: softprops/action-gh-release@v1
43+
if: startsWith(github.ref, 'refs/tags/')
44+
with:
45+
body: |
46+
Release JvmOptionsParser ${{ steps.get_version.outputs.VERSION }}.
47+
- https://github.com/dyrnq/JvmOptionsParser/releases/download/${{ steps.get_version.outputs.VERSION }}/JvmOptionsParser.java ([checksum](https://github.com/dyrnq/JvmOptionsParser/releases/download/${{ steps.get_version.outputs.VERSION }}/JvmOptionsParser.java.sha256sum))
48+
- https://github.com/dyrnq/JvmOptionsParser/releases/download/${{ steps.get_version.outputs.VERSION }}/JvmOptionsParser.jar ([checksum](https://github.com/dyrnq/JvmOptionsParser/releases/download/${{ steps.get_version.outputs.VERSION }}/JvmOptionsParser.jar.sha256sum))
49+
files: |
50+
dist/JvmOptionsParser.jar
51+
JvmOptionsParser.jar.sha256sum
52+
src/main/java/JvmOptionsParser.java
53+
JvmOptionsParser.java.sha256sum

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.DS_Store
2+
3+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
4+
target/
5+
.mvn/timing.properties
6+
.mvn/wrapper/maven-wrapper.jar
7+
!**/src/main/**/target/
8+
!**/src/test/**/target/
9+
10+
11+
### STS ###
12+
.apt_generated
13+
.classpath
14+
.factorypath
15+
.project
16+
.settings
17+
.springBeans
18+
.sts4-cache
19+
20+
### IntelliJ IDEA ###
21+
.idea
22+
*.iws
23+
*.iml
24+
*.ipr
25+
26+
### NetBeans ###
27+
/nbproject/private/
28+
/nbbuild/
29+
/dist/
30+
/nbdist/
31+
/.nb-gradle/
32+
!**/src/main/**/build/
33+
!**/src/test/**/build/
34+
35+
### VS Code ###
36+
.vscode/
37+
38+
39+
.vagrant/
40+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
41+
hs_err_pid*
42+
.flattened-pom.xml
43+
44+
45+
*.class
46+
logs
47+
build
48+
dist
49+
pom.xml
50+
conf

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright © 2024 <copyright holders>
2+
3+
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:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
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.

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# JvmOptionsParser.java
2+
3+
Inspired by [InstallCert](https://github.com/escline/InstallCert)
4+
and [/etc/elasticsearch/jvm.options](https://github.com/elastic/elasticsearch/blob/main/distribution/src/config/jvm.options)
5+
6+
## Usage
7+
8+
Need to compile, first:
9+
10+
```
11+
javac --source 1.8 --target 1.8 -d . src/main/java/JvmOptionsParser.java
12+
```
13+
14+
```bash
15+
java JvmOptionsParser <args>
16+
```
17+
18+
> **Note** since Java 11, you can run it directly without compiling it first:
19+
20+
```
21+
java src/main/java/JvmOptionsParser.java <args>
22+
```
23+
24+
## Jar
25+
26+
```bash
27+
ant
28+
29+
java -jar dist/JvmOptionsParser.jar <args>
30+
```
31+
32+
download precompiled jar
33+
34+
```bash
35+
curl -fsSL -O https://github.com/dyrnq/JvmOptionsParser/releases/download/v0.0.1/JvmOptionsParser.jar
36+
37+
java -jar JvmOptionsParser.jar <args>
38+
```
39+
40+
## Args and ENV
41+
42+
need args pass a conf folder or file
43+
44+
- folder eg. `java -jar JvmOptionsParser.jar /etc/es`, then `/etc/es/jvm.options + /etc/es/jvm.options.d/*.options`.
45+
- file eg. `java -jar JvmOptionsParser.jar /etc/es/my.options`, `then /etc/es/my.options + /etc/es/jvm.options.d/*.options`.
46+
- env ES_JAVA_OPTS JAVA_OPTS JAVA_OPTIONS JVM_OPTS JVM_OPTIONS.
47+
48+
## Ref
49+
50+
- [JVM options syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/advanced-configuration.html#jvm-options-syntax)
51+
- [src/config/jvm.options](https://github.com/elastic/elasticsearch/blob/main/distribution/src/config/jvm.options)
52+
- <https://developer.axonivy.com/doc/8.0/engine-guide/configuration/files/jvm-options.html>

build.xml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<project name="JvmOptionsParser" default="dist" basedir=".">
2+
<description>JvmOptionsParser build file</description>
3+
<!--
4+
ref https://stackoverflow.com/questions/24654422/how-to-create-an-executable-jar-with-ant
5+
-->
6+
7+
<property name="ProjectName" value="${basedir}"/>
8+
<property name="jarFileName" value="${ant.project.name}"/>
9+
<property name="RunnableMain-Class" value="JvmOptionsParser"/>
10+
11+
<property name="build" value="${ProjectName}/build"/>
12+
<property name="dist" value="${ProjectName}/dist"/>
13+
<property name="class-files" value="${build}/classes"/>
14+
<property name="buildPath-Libraries" value="${ProjectName}/lib"/>
15+
<property name="source-dir" value="${ProjectName}/src/main/java"/>
16+
17+
<property name="Ant-Version" value="Apache Ant 1.8.2"/>
18+
<property name="Built-By" value="dyrnq"/>
19+
20+
<path id="buildLibraries"> <!-- http://ant.apache.org/manual/using.html#path -->
21+
<fileset dir="${buildPath-Libraries}">
22+
<include name="*.jar"/>
23+
</fileset>
24+
</path>
25+
26+
<target name="clean">
27+
<delete includeEmptyDirs="true" failonerror="false" verbose="true">
28+
<fileset dir="${class-files}" includes="**/*"/>
29+
</delete>
30+
</target>
31+
32+
<!-- compile -->
33+
<target name="compile">
34+
<mkdir dir="${class-files}"/>
35+
<javac srcdir="${source-dir}" destdir="${class-files}" includeantruntime="false" encoding="utf-8" source="1.8"
36+
target="1.8" verbose="true">
37+
<!-- <classpath refid="buildLibraries"/>-->
38+
</javac>
39+
</target>
40+
<!-- jar -->
41+
<target name="dist" depends="clean,compile">
42+
43+
<manifest file="${build}/MANIFEST.MF"> <!-- Manifest-Version: 1.0 -->
44+
<attribute name="Built-By" value="${Built-By}"/>
45+
<attribute name="Ant-Version" value="${Ant-Version}"/>
46+
<attribute name="Main-Class" value="${RunnableMain-Class}"/>
47+
<attribute name="Class-Path" value="."/>
48+
</manifest>
49+
50+
<jar destfile="${dist}/${jarFileName}.jar" basedir="${class-files}"
51+
manifest="${build}/MANIFEST.MF">
52+
<fileset dir="${class-files}" includes="**/*.class"/>
53+
<!-- <zipgroupfileset dir="${buildPath-Libraries}" includes="**/*.jar"/>-->
54+
</jar>
55+
</target>
56+
</project>

0 commit comments

Comments
 (0)