avisi-cloud/structurizr-site-generatr

FileNotFoundException when generating a website

Closed this issue · 3 comments

Hi,

Using the last commit as a docker image, when I try to build my Structuzr DSL into a website (without multibranch support), I get this error:

Exception in thread "main" java.io.FileNotFoundException: public/master/workspace.json (No such file or directory)
	at java.base/java.io.FileOutputStream.open0(Native Method)
	at java.base/java.io.FileOutputStream.open(Unknown Source)
	at java.base/java.io.FileOutputStream.<init>(Unknown Source)
	at java.base/java.io.FileOutputStream.<init>(Unknown Source)
	at kotlin.io.FilesKt__FileReadWriteKt.writeBytes(FileReadWrite.kt:108)
	at kotlin.io.FilesKt__FileReadWriteKt.writeText(FileReadWrite.kt:134)
	at kotlin.io.FilesKt__FileReadWriteKt.writeText$default(FileReadWrite.kt:134)
	at nl.avisi.structurizr.site.generatr.site.SiteGeneratorKt.writeStructurizrJson(SiteGenerator.kt:60)
	at nl.avisi.structurizr.site.generatr.GenerateSiteCommand.generateSiteForModel(GenerateSiteCommand.kt:129)
	at nl.avisi.structurizr.site.generatr.GenerateSiteCommand.execute(GenerateSiteCommand.kt:73)
	at kotlinx.cli.ArgParser.parse(ArgParser.kt:657)
	at kotlinx.cli.ArgParser.parse(ArgParser.kt:530)
	at nl.avisi.structurizr.site.generatr.AppKt.main(App.kt:13)

When I check the public folder after the error, the "master" (or <branch_name>) folder is indeed missing.
It seems to happen after this commit: d172d54

Thanks.

Thanks for the report and for also for using the version from master. Yeah, seems like we create that folder at a later stage :( Should be simple to fix though.

On my local branch, I fixed it using File(exportDir).mkdirs() just above the line generating the json.
I guess you can easily do it yourself instead of waiting for my one liner merge request 😆 .

FYI, I'm using the master version to fork the project to fit my company's needs. If I can achieve results usable in a generic environment, I'll surely propose some features/improvements upstream.

@victorlevasseur Could you give the linked PR a shot? Chances are small I borked this again, but just to be sure that we covered all your use cases.