MTrop / DoomTools

Doom-related tools for Java. Home of DECOHack and lots of other utilities. Build WAD projects (and soon, other kinds) with ease!
https://mtrop.github.io/DoomTools/
MIT License
46 stars 5 forks source link

Bash fails to run commands because deployer does not copy JAR to jar/ directory as documented #97

Closed claussni closed 1 year ago

claussni commented 1 year ago

When using the ant deploy.bash -Ddeploy.dir=/somedir command the built jar file is expected in /somedir/jar/. Yet, it is just copied to /somedir:

# ls
 AUTHORS.txt                 LICENSE.txt                  changelogs   doommake                             rookscript   wtexport
 CHANGELOG.md                README.md                    decohack     doomtools                            wadmerge     wtexscan
'DECOHack Help.txt'         'RookScript Quick Guide.md'   dimgconv     doomtools-2023.08.18.111422266.jar   wadscript
'DeHackEd Hardcodings.txt'  'WadMerge Help.txt'           dmxconv      doomtools-logo.ico                   wadtex
'DoomMake Help.txt'         'WadScript Help.txt'          doomfetch    licenses                             wswantbl

Consequently the run scripts fail to start the programm:

# ./doomtools 
./doomtools: line 19: cd: /opt/jar: No such file or directory
Error: Could not find or load main class net.mtrop.doom.tools.DoomToolsMain
Caused by: java.lang.ClassNotFoundException: net.mtrop.doom.tools.DoomToolsMain
MTrop commented 1 year ago

I cannot replicate this locally (Windows, MinGW Msys 1.0). The deploy step works as intended on my machine.

The deploy.bash target first creates a TAR.GZ file in dist that it then deploys from. The directory structure should be there in the file, and preserved on deploy.

Could you please check if your TAR file contains folder information? It could either be the fault of the packaging step (Ant) or the deployment step (which uses platform-native TAR for extracting).

Thank you!

MTrop commented 1 year ago

Also cannot replicate locally on Ubuntu VM (WSL, Ubuntu 20.04.6). Packaging and extracting steps work.

tar -tvf on the dist tar displays correct path information. Untarring via build script preserves folders.

MTrop commented 1 year ago

It almost appears like the version of Ant you are running isn't respecting the prefix attribute on the tarfileset and zipfileset elements in the dist.bash target. That changelogs and licenses folder should be under docs, as well as the jar file under jar. Those directories may not be created on your packaging step for whatever reason.

Can you verify the version of Apache Ant that you are running?

claussni commented 1 year ago

Found the cause of the problem. It's not about Ant. It's the Docker COPY directive dissolving all the directories.

This will copy just the files and cause the issue:

COPY --from=build /opt/* .

This copies the whole folder as build by ant and everything works as expected:

COPY --from=build /opt/ .