Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.7.3 broken on Windows #381

Open
2 of 5 tasks
ogerardin opened this issue Dec 4, 2023 · 2 comments
Open
2 of 5 tasks

v1.7.3 broken on Windows #381

ogerardin opened this issue Dec 4, 2023 · 2 comments
Labels
bug Something isn't working feedback Waiting for feedback

Comments

@ogerardin
Copy link
Contributor

I'm submitting a…

  • bug report
  • feature request
  • other

Short description of the issue/suggestion:
v1.7.3 and later are broken on Windows. No issue until 1.7.2.

[ERROR] MSI installer generation failed due to: Command execution failed: light -spdb -out C:\Users\gerardin\IdeaProjects\xpman\xpman-fx-dist\target\X-Plane Manager_1.0-SNAPSHOT.msm C:\Users\gerardin\IdeaProjects\xpman\xpman-fx-dist\target\assets\X-Plane Manager.msm.wixobj
Steps to reproduce the issue/enhancement:

Bump plugin version to 1.7.3

What is the expected behavior?

No regression.

What is the current behavior?

Fails with error message.

Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?

[ERROR]     MSI installer generation failed due to: Command execution failed: light -spdb -out C:\Users\gerardin\IdeaProjects\xpman\xpman-fx-dist\target\X-Plane Manager_1.0-SNAPSHOT.msm C:\Users\gerardin\IdeaProjects\xpman\xpman-fx-dist\target\assets\X-Plane Manager.msm.wixobj
[ERROR] 
org.codehaus.plexus.util.cli.CommandLineException: Command execution failed: light -spdb -out C:\Users\gerardin\IdeaProjects\xpman\xpman-fx-dist\target\X-Plane Manager_1.0-SNAPSHOT.msm C:\Users\gerardin\IdeaProjects\xpman\xpman-fx-dist\target\assets\X-Plane Manager.msm.wixobj
    at io.github.fvarrui.javapackager.utils.CommandUtils.executeOnDirectory (CommandUtils.java:20)
    at io.github.fvarrui.javapackager.utils.CommandUtils.execute (CommandUtils.java:30)
    at io.github.fvarrui.javapackager.packagers.GenerateMsm.doApply (GenerateMsm.java:65)
    at io.github.fvarrui.javapackager.packagers.GenerateMsi.doApply (GenerateMsi.java:40)
    at io.github.fvarrui.javapackager.packagers.GenerateMsi.doApply (GenerateMsi.java:16)
    at io.github.fvarrui.javapackager.packagers.ArtifactGenerator.apply (ArtifactGenerator.java:44)
    at io.github.fvarrui.javapackager.packagers.Packager.generateInstallers (Packager.java:447)
    at io.github.fvarrui.javapackager.maven.PackageMojo.execute (PackageMojo.java:387)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:910)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)


What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • JavaPackager version: 1.7.3
  • OS version: Windows 11
  • JDK version: 17
  • Build tool:
    • Maven
    • Gradle

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

@fvarrui
Copy link
Owner

fvarrui commented Dec 13, 2023

Hi @ogerardin!
I've managed to reproduce your issue with WiX Toolset 3.11.2.4516 ... I guess new versions are more restrictive than previous ones.

Here you have a quick fix, until I can patch and release JP 1.7.6:

Just create ${project.basedir}/assets/windows/msm.wxs.vtl file with next content and will use this template instead of the default one:

#set ($name = $info.name.replaceAll("[^A-Za-z0-9_.]", "_"))
#set ($id = 0)
#macro(list $file)
	#set($guid = $GUID.randomUUID())
	#set($id = $id + 1)
	#if($file.isDirectory())
	    #if($file.equals(${info.appFolder}))
		<Directory Id="INSTALLFOLDER" Name="${file.name}">
		#else
		<Directory Id="_${id}" Name="${file.name}">
		#end
		#foreach($child in $file.listFiles())
			#list($child)
		#end
		</Directory>
	#else
		<Component Id="_${id}" Guid="${guid}" Win64="yes">
	    #if($file.equals(${info.executable}))
	    	<File Id="EXEFILE" Name="${guid}_${file.name}" KeyPath="yes" Source="${file}">
				<Shortcut Id="ApplicationStartMenuShortcut" Name="${info.winConfig.shortcutName}" Description="${info.description}" Directory="ProgramMenuFolder" />
	    	</File>
			<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
			<RegistryValue Root="HKLM" Key="Software\\${info.organizationName}\\${info.name}" Name="installed" Type="integer" Value="1" />
		#else
			<File Name="${guid}_${file.name}" KeyPath="yes" Source="${file}"/>
		#end
		</Component>
	#end
#end
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
	<Module Id="${name}_Module" Codepage="1252" Language="1033" Version="${info.winConfig.productVersion}">
		<Package Id="${GUID.randomUUID()}" Manufacturer="${info.organizationName}" InstallerVersion="200" Languages="1033" Platform="x64" SummaryCodepage="1252" Description="${info.description}"/>
		<Directory Id="TARGETDIR" Name="SourceDir">
			#list(${info.appFolder})
			<Directory Id="ProgramMenuFolder" />
#if ($info.winConfig.registry)
			<Component Id="RegistryEntries" Guid="${GUID.randomUUID()}">
#foreach ($entry in $info.winConfig.registry.entries)
				<RegistryKey Root="${entry.root}" Key="${entry.subkey}" ForceDeleteOnUninstall="yes">
					<RegistryValue 
						Type="${entry.valueTypeAsWIXToolsetString}"
#if ($entry.valueName)
						Name="$!{entry.valueName}"
#end
#if ($entry.valueData)
						Value="$!{entry.valueData}"
#end
					/>
				</RegistryKey>
#end
			</Component>
#end
		</Directory>
	</Module>
</Wix>

Now it concats guid to filename, in order to avoid duplicated files:

#if($file.equals(${info.executable}))
    <File Id="EXEFILE" Name="${guid}_${file.name}" KeyPath="yes" Source="${file}">
        <Shortcut Id="ApplicationStartMenuShortcut" Name="${info.winConfig.shortcutName}" Description="${info.description}" Directory="ProgramMenuFolder" />
    </File>
    <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
    <RegistryValue Root="HKLM" Key="Software\\${info.organizationName}\\${info.name}" Name="installed" Type="integer" Value="1" />
#else
    <File Name="${guid}_${file.name}" KeyPath="yes" Source="${file}"/>
#end

I hope it helps!

@fvarrui fvarrui added bug Something isn't working feedback Waiting for feedback labels Dec 13, 2023
@ogerardin
Copy link
Contributor Author

Thanks for your investigation!
So far I don't have a real need to update to 1.7.3, so I will wait for 1.7.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feedback Waiting for feedback
Projects
None yet
Development

No branches or pull requests

2 participants