使用 SBT Native Packager 时如何修复错误 LGHT0094?

How do I fix error LGHT0094 when using SBT Native Packager?

我最近才开始使用 SBT Native Packager(版本 1.0.4 和 1.0.5-M3)。每当我 运行:

windows:packageBin

我收到以下错误:

error LGHT0094 : Unresolved reference to symbol 'Directory:bin97543xxxx' in section 'Product:{98A830B8-2CC3-45EF-93DB-A5701E999432}'.

wix 文件包含:

  <!-- Define the directories we use -->
  <Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramMenuFolder">
      <Directory Id="ApplicationProgramsFolder" Name="root"/>
    </Directory>
    <Directory Id="ProgramFilesFolder" Name="PFiles">
      <Directory Id="INSTALLDIR" Name="root">
        <Directory Id="lib107141xxx" Name="lib">

  </Directory><!-- -->
      </Directory>
    </Directory>
  </Directory>
  <!-- Now define the components -->
  <DirectoryRef Id="lib107141xxx">
        <Component Id="nt_root_0_1_0_1c2a7be873a6a59bfeb964353cf0dca4d91eb1af_jar157860110" Guid="41b197e8-de4b-4bf2-a73f-b93f9ab2ffbc">
          <File Id="fl_nt_root_0_1_0_1c2a7be873a6a59bfeb964353cf0dca4d91eb1af_jar157860110" Name="com.example.test-client.root-0.1.0-1c2a7be873a6a59bfeb964353cf0dca4d91eb1af.jar" DiskId="1" Source="lib\com.example.test-client.root-0.1.0-1c2a7be873a6a59bfeb964353cf0dca4d91eb1af.jar">

          </File>
        </Component>
      </DirectoryRef><DirectoryRef Id="lib107141xxx">
        <Component Id="lib_org_scala_lang_scala_library_2_10_5_jar104451402" Guid="7b7c4d4c-947f-4130-b2a9-9c0b9bcc3a50">
          <File Id="fl_lib_org_scala_lang_scala_library_2_10_5_jar104451402" Name="org.scala-lang.scala-library-2.10.5.jar" DiskId="1" Source="lib\org.scala-lang.scala-library-2.10.5.jar">

          </File>
        </Component>
      </DirectoryRef><DirectoryRef Id="bin97543xxxx">
        <Component Id="bin97543xxxxPathC" Guid="11fce8cf-c70c-4335-af67-06a6278c4d78">
          <CreateFolder/>
          <Environment Id="ROOT_HOME" Name="ROOT_HOME" Value="[INSTALLDIR]" Permanent="no" Action="set" System="yes"/>
          <Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="last" Action="set" System="yes"/>
        </Component>
      </DirectoryRef><DirectoryRef Id="ApplicationProgramsFolder">
        <Component Id="shortcut_d3018014_95df_4633_889a_84d5b605b8bd121149574" Guid="f54458a7-396c-4e45-868d-2fe4b5650d4a">

          <RemoveFolder Id="ApplicationProgramsFolderRemove" Directory="ApplicationProgramsFolder" On="uninstall"/>
          <RegistryValue Root="HKCU" Key="Software\Example.com\root" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
        </Component>
      </DirectoryRef>
  <!-- Now define the features! -->
  <Feature Id="Complete" Title="test-client-windows" Description="Secure Client Windows MSI." Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR">
    <Feature Id="root_core867490596" Title="root" Description="All core files." Level="1" Absent="disallow">
                <ComponentRef Id="nt_root_0_1_0_1c2a7be873a6a59bfeb964353cf0dca4d91eb1af_jar157860110"/><ComponentRef Id="lib_org_scala_lang_scala_library_2_10_5_jar104451402"/>
              </Feature><Feature Id="AddBinToPath" Title="Update Enviornment Variables" Description="Update PATH environment variables (requires restart)." Level="1" Absent="allow">
                <ComponentRef Id="bin97543xxxxPathC"/>
              </Feature><Feature Id="AddConfigLinks" Title="Configuration start menu links" Description="Adds start menu shortcuts to edit configuration files." Level="1" Absent="allow">
                <ComponentRef Id="shortcut_d3018014_95df_4633_889a_84d5b605b8bd121149574"/>
              </Feature>
  </Feature>
  <MajorUpgrade AllowDowngrades="no" Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
  <UIRef Id="WixUI_FeatureTree"/>
  <UIRef Id="WixUI_ErrorProgressText"/>
  <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>


  </Product>
</Wix>

现在我不太了解 SBT Native Packager 或 WiX,但我从阅读 DirectoryRef Element 中猜测应该有一个对应的 Directory 元素,其 id bin97543xxxx 没有似乎在那里。

我快速查看了 WixHelper.scalaWindowsPlugin.scala,但问题可能出在哪里并不是很明显。我想这与 WindowsPlugin.scala 中的以下内容有关:

val addBinToPath =
  // TODO - we may have issues here...
  WindowsFeature(
    id = "AddBinToPath",
    title = "Update Enviornment Variables",
    desc = "Update PATH environment variables (requires restart).",
    components = Seq(AddDirectoryToPath("bin"))
  )

知道如何解决这个问题吗?

好的,这里的问题是没有创建 bat 脚本。这是因为我有一个多项目构建,而根项目没有主项目 class.

为了解决这个问题,我添加了以下内容:

mainClass in (Compile, batScriptReplacements) <<= (mainClass in (Compile, batScriptReplacements) in mainProject)

其中 mainProject 是具有主要 class 的子项目。