Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lab3v23
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eskil.Yttri
lab3v23
Commits
a5dd8cf1
Commit
a5dd8cf1
authored
2 years ago
by
Torstein Strømme
Browse files
Options
Downloads
Patches
Plain Diff
creating installer now works (checked for Mac, not Windows)
parent
be8f52e5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
make/build_app_mac.sh
+35
-1
35 additions, 1 deletion
make/build_app_mac.sh
make/build_app_windows.bat
+2
-1
2 additions, 1 deletion
make/build_app_windows.bat
pom.xml
+19
-7
19 additions, 7 deletions
pom.xml
with
56 additions
and
9 deletions
build_app_mac.sh
→
make/
build_app_mac.sh
+
35
−
1
View file @
a5dd8cf1
...
...
@@ -30,8 +30,11 @@ echo " PROJECT_VERSION: $PROJECT_VERSION" # version in pom, e.g. "1.0-SNAPSHOT"
echo
"computed variables..."
CURRENT_YEAR
=
$(
date
+
'%Y'
)
echo
" CURRENT_YEAR:
$CURRENT_YEAR
"
PATH_TO_MAIN_CLASS
=
"target/classes/
${
MAIN_CLASS
//
'.'
//
}
.class"
#PATH_TO_MAIN_CLASS="target/classes/${MAIN_CLASS//'.'//}.class"
PATH_TO_MAIN_CLASS
=
"target/classes/
${
APP_PACKAGE
//
'.'
//
}
/"
echo
" PATH_TO_MAIN_CLASS:
$PATH_TO_MAIN_CLASS
"
echo
" pwd: "
pwd
# ------ SETUP DIRECTORIES AND FILES ----------------------------------------
# Remove previously generated java runtime and installers. Copy all required
...
...
@@ -54,6 +57,14 @@ cp "target/${MAIN_JAR}" target/installer/input/libs/
## application.
echo
"detecting required modules.."
echo
"
$JAVA_HOME
/bin/jdeps"
\
-q
\
--multi-release
"
${
JAVA_VERSION
}
"
\
--ignore-missing-deps
\
--print-module-deps
\
--class-path
"target/installer/input/libs/*"
\
"
$PATH_TO_MAIN_CLASS
"
detected_modules
=
$(
"
$JAVA_HOME
/bin/jdeps"
\
-q
\
--multi-release
"
${
JAVA_VERSION
}
"
\
...
...
@@ -75,6 +86,14 @@ echo " detected modules: ${detected_modules}"
# works with dependencies that are not fully modularized, yet.
echo
"creating java runtime image..."
echo
"
$JAVA_HOME
/bin/jlink"
\
--strip-native-commands
\
--no-header-files
\
--no-man-pages
\
--compress
=
2
\
--strip-debug
\
--add-modules
"
${
detected_modules
}
"
\
--output
target/java-runtime
"
$JAVA_HOME
/bin/jlink"
\
--strip-native-commands
\
--no-header-files
\
...
...
@@ -88,6 +107,21 @@ echo "creating java runtime image..."
# In the end we will find the package inside the target/installer directory.
echo
"creating installer of type
$INSTALLER_TYPE
..."
echo
"
$JAVA_HOME
/bin/jpackage"
\
--type
"
$INSTALLER_TYPE
"
\
--dest
target/installer
\
--input
target/installer/input/libs
\
--name
"
${
PROJECT_NAME
}
"
\
--main-class
"
${
MAIN_CLASS
}
"
\
--main-jar
"
${
MAIN_JAR
}
"
\
--runtime-image
target/java-runtime
\
--icon
"
${
ICON_PATH
}
"
\
--app-version
"
${
APP_VERSION
}
"
\
--vendor
"
${
APP_VENDOR
}
"
\
--copyright
"Copyright ©
${
CURRENT_YEAR
}
${
APP_VENDOR
}
."
\
--mac-package-identifier
"
${
APP_PACKAGE
}
"
# --java-options -Xmx2048m \
"
$JAVA_HOME
/bin/jpackage"
\
--type
"
$INSTALLER_TYPE
"
\
--dest
target/installer
\
...
...
This diff is collapsed.
Click to expand it.
build_app_windows.bat
→
make/
build_app_windows.bat
+
2
−
1
View file @
a5dd8cf1
...
...
@@ -29,7 +29,8 @@ ECHO " PROJECT_NAME: %PROJECT_NAME%"
ECHO
" PROJECT_VERSION:
%PROJECT_VERSION%
"
ECHO
"computed variables..."
SET
PATH_TO_MAIN
=
"target\classes\
%MAIN
_CLASS:.=\
%
.class"
@REM SET PATH_TO_MAIN="target\classes\%MAIN_CLASS:.=\%.class"
SET
PATH_TO_MAIN
=
"target\classes\
%APP
_PACKAGE:.=\
%
"
ECHO
" PATH_TO_MAIN:
%PATH_TO_MAIN%
"
SET
YEAR
=
%DATE
:
~
6
,
4
%
ECHO
" YEAR:
%YEAR%
"
...
...
This diff is collapsed.
Click to expand it.
pom.xml
+
19
−
7
View file @
a5dd8cf1
...
...
@@ -5,10 +5,10 @@
<modelVersion>
4.0.0
</modelVersion>
<!-- Major project properties -->
<groupId>
no.uib.inf101.
app
</groupId>
<artifactId>
SamplePackagedSwingApp
</artifactId>
<groupId>
no.uib.inf101.
terminal
</groupId>
<!-- must match package of Main class -->
<artifactId>
INF101ShellLab
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<name>
Sample Application
</name>
<name>
INF101 Shell Lab
</name>
<packaging>
jar
</packaging>
<properties>
...
...
@@ -17,8 +17,8 @@
<java.version>
17
</java.version>
<!-- Properties required for packaging application as JAR and installer -->
<app.main.class>
no.uib.inf101.terminal.Main
</app.main.class
>
<app.vendor>
Torstein Strømme
</app.vendor>
<!--
copyright holder
-->
<app.main.class>
${groupId}.Main
</app.main.class>
<!-- name of main class --
>
<app.vendor>
Torstein Strømme
</app.vendor>
<!--
replace with your name
-->
<app.version>
1.0.0
</app.version>
<!-- version displayed in "about" -->
<app.installer.macosx.type>
dmg
</app.installer.macosx.type>
<!-- dmg, pkg -->
<app.installer.windows.type>
msi
</app.installer.windows.type>
<!-- msi, exe -->
...
...
@@ -30,6 +30,7 @@
<maven.compiler.plugin.version>
3.10.1
</maven.compiler.plugin.version>
<maven.dependency.plugin.version>
3.4.0
</maven.dependency.plugin.version>
<maven.jar.plugin.version>
3.3.0
</maven.jar.plugin.version>
<maven.surefire.plugin.version>
3.0.0-M5
</maven.surefire.plugin.version>
<exec.maven.plugin.version>
1.6.0
</exec.maven.plugin.version>
<!-- Computed properties -->
...
...
@@ -99,6 +100,17 @@
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
${maven.surefire.plugin.version}
</version>
<dependencies>
<dependency>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter-engine
</artifactId>
<version>
${junit.version}
</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
...
...
@@ -125,7 +137,7 @@
</executions>
<configuration>
<workingDirectory>
${project.basedir}
</workingDirectory>
<executable>
./build_app_mac.sh
</executable>
<executable>
./
make/
build_app_mac.sh
</executable>
<environmentVariables>
<APP_PACKAGE>
${project.groupId}
</APP_PACKAGE>
<ABOUT_NAME>
${project.name}
</ABOUT_NAME>
...
...
@@ -168,7 +180,7 @@
</executions>
<configuration>
<workingDirectory>
${project.basedir}
</workingDirectory>
<executable>
build_app_windows.bat
</executable>
<executable>
./make/
build_app_windows.bat
</executable>
<environmentVariables>
<APP_PACKAGE>
${project.groupId}
</APP_PACKAGE>
<APP_VENDOR>
${app.vendor}
</APP_VENDOR>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment