Skip to content

[feature] get rid of appassembler-maven-plugin#5951

Open
dizzzz wants to merge 15 commits intoeXist-db:developfrom
dizzzz:cicd/revise_startupscripts
Open

[feature] get rid of appassembler-maven-plugin#5951
dizzzz wants to merge 15 commits intoeXist-db:developfrom
dizzzz:cicd/revise_startupscripts

Conversation

@dizzzz
Copy link
Member

@dizzzz dizzzz commented Nov 30, 2025

Context

Until now, eXist used the outdated appassembler-maven-plugin to create the startup code the application. It created a set of shell scripts, each invoked a boot loader, which read an XML file to find the relevant JAR files, created its own classloader and invoked the class org.exist.start.Main to get eXist started.

As a drawback it was difficult to add an extra jar file or to apply an hotfix by updating one jar file.

Since java 8 or so the 'java' commands allows an * in the classpath. This PR effectively make use of this feature.

@duncdrum I think this might be useful for our docker deployments.


old content of etc directory:

image

old content of XML file:

<?xml version="1.0" encoding="UTF-8"?>
<daemon>
  <id>client</id>
  <mainClass>org.exist.start.Main</mainClass>
  <classpath>
    <dependencies>
      <dependency>
        <groupId>org.exist-db</groupId>
        <artifactId>exist-distribution</artifactId>
        <version>7.0.0-SNAPSHOT</version>
        <relativePath>exist-distribution-7.0.0-SNAPSHOT.pom</relativePath>
      </dependency>
      
	  <!-- 1000's of generated lines -->
	  
      <dependency>
        <groupId>stax</groupId>
        <artifactId>stax-api</artifactId>
        <version>1.0.1</version>
        <relativePath>stax-api-1.0.1.jar</relativePath>
      </dependency>
    </dependencies>
  </classpath>
  <commandLineArguments>
    <commandLineArgument>client</commandLineArgument>
  </commandLineArguments>
  <configurationDirectory>etc</configurationDirectory>
  <repositoryName>lib</repositoryName>
  <licenseHeaderFile>/....../LGPL-21-license.txt</licenseHeaderFile>
</daemon>

@dizzzz dizzzz changed the title [feature[ [feature] get rid of appassembler-maven-plugin Nov 30, 2025
@dizzzz dizzzz requested a review from duncdrum November 30, 2025 21:00
@dizzzz dizzzz marked this pull request as ready for review November 30, 2025 21:01
@dizzzz dizzzz requested a review from a team as a code owner November 30, 2025 21:01
@dizzzz

This comment was marked as outdated.

@dizzzz dizzzz force-pushed the cicd/revise_startupscripts branch from bb05d7e to 4677bca Compare November 30, 2025 21:26
@dizzzz dizzzz marked this pull request as draft December 1, 2025 06:48
@dizzzz

This comment was marked as resolved.

@duncdrum
Copy link
Contributor

duncdrum commented Dec 1, 2025

very cool, a bit too much to think about for the comments here. Yes wildcard works even with J8, been running it for 4 years now. We would need to keep an eye on the backup, recovery, etc workflows on all three OSs to make sure they still work. We have no integration tests for this, so we need to do it manually.

The Dockerfiles here and at duncdrum/existdb will need adjustments.

I really like the idea of improvements to modifying JAVA_TOOL_OPTIONS and introducing EXIST_OPTS. Note that for java 21 you can use JDK_JAVA_OPTIONS to get some compostability going see tp-app as far as I understand it JAVA_OPTS is not a thing.

@dizzzz
Copy link
Member Author

dizzzz commented Dec 1, 2025

I have seen 'JAVA_OPTS' mostly in old scripts, it looks like it was a pattern once used in the tomcat scripts.

setting this details in an environment variable will will make the scripts more clean and readable.

I will revise the PR with the ideas.

@adamretter
Copy link
Contributor

adamretter commented Dec 1, 2025

Since java 8 or so the 'java' commands allows an * in the classpath. This PR effectively make use of this feature.

That could open up a security issue, as an attacker can just drop a jar file into a folder.

I have seen 'JAVA_OPTS' mostly in old scripts, it looks like it was a pattern once used in the tomcat scripts

JAVA_OPTS is pretty much defacto for all Java applications these days, and has been for many years. Users and developers have come to expect it.

JAVA_TOOL_OPTIONS
JDK_JAVA_OPTIONS

You should avoid these as they have much wider implications.

@dizzzz
Copy link
Member Author

dizzzz commented Dec 1, 2025

I considered the potential security issue already. When the variables are locally defined, and the java command is the last one in sequence, there should be no side effects IMO. If one has access for writing access anyway, an existing jar file (or the xml) can be updated any way. The security risk is merely changed not different.

I checked a bit more on 'JAVA_OPTS' it seems to be originated from the Catalina scripts, hence an implementation decision? I will check a bit more though. I will follow this pattern.

@dizzzz dizzzz force-pushed the cicd/revise_startupscripts branch from 58f72fc to b96a7d5 Compare January 25, 2026 16:08
…vious, it looks OK, but I need help to test as i do not have windows available. Note that Java can not create windows symlinks.
@dizzzz
Copy link
Member Author

dizzzz commented Jan 25, 2026

note 1: to myself: as symlink alternative

<echo file="${assemble.dir}/bin/backup.bat">@echo off
call "%~dp0template.bat" %*
</echo>

note 2: eXist-db.app does not start

@dizzzz dizzzz requested review from line-o and reinhapa January 25, 2026 19:35
@dizzzz dizzzz marked this pull request as ready for review January 31, 2026 10:22
@dizzzz dizzzz force-pushed the cicd/revise_startupscripts branch from 66c475b to 56774aa Compare February 1, 2026 18:32
Copy link
Member

@line-o line-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am in favour of this change. It might be good to have a look at the code analysis warnings to see if there is a useful improvement to be made.

Copy link
Contributor

@duncdrum duncdrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much cleaner I like it. not sure how it would affect docker though, there is no shell in our base images.

@dizzzz
Copy link
Member Author

dizzzz commented Feb 10, 2026

I think that for Docker there are no differences, like you Said

Copy link
Member

@reinhapa reinhapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dizzzz there seems to be some warnings from static code analysis left. Could you look into these as well?

@line-o
Copy link
Member

line-o commented Feb 11, 2026

@reinhapa at this point as @dizzzz already did go the extra mile and addressed the ones he found to be important to be fixed I would like you to go through the remaining ones and point out which you think should be fixed.

@line-o
Copy link
Member

line-o commented Feb 11, 2026

Screenshot 2026-02-11 at 09 45 31

echo "################"
fi

# Dot not double quote variables below
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the following two codacy warnings must be ignored

@line-o
Copy link
Member

line-o commented Feb 11, 2026

2 of those warnings have to be itgnored as we cannot put double quotes around them

@line-o
Copy link
Member

line-o commented Feb 11, 2026

That leaves one warning about the Darwin property never being used. Is that so @dizzzz ?

@dizzzz
Copy link
Member Author

dizzzz commented Feb 11, 2026

Right :) but maybe we should report the detected modus in debug mode?

Interestingly the original scripts have the same unused item. I decided to leave it in :)

@line-o
Copy link
Member

line-o commented Feb 11, 2026

Then @dizzzz either remove it or expose it as you choose. I suspect that we will not stop here to further improve exist-db's startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants