Giter Club home page Giter Club logo

sbt-izpack's Introduction

IzPack SBT Plugin

Introduction

This project contains an IzPack plugin for SBT 0.10.1 or greater.

For SBT 0.7.x, see the previous version of this plugin.

For complete documentation, see the IzPack Plugin web site.

License

This plugin is released under a BSD license, adapted from http://opensource.org/licenses/bsd-license.php

Copyright © 2010-2012, Brian M. Clapper All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the names "clapper.org", "sbt-izpack", nor the names of any contributor may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

sbt-izpack's People

Contributors

bmc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sbt-izpack's Issues

Tell where the error lies in izpack.yml

A message like this is not very self-explanatory:

[error] (rds/izpack:createXml) org.clapper.sbt.izpack.IzPluginException: null; Can't construct a java object for tag:yaml.org,2002:org.clapper.sbt.izpack.IzPackYamlConfig; exception=Cannot create property=panels for JavaBean=org.clapper.sbt.izpack.IzPackYamlConfig@2a698ad0; Cannot create property=panel for JavaBean=org.clapper.sbt.izpack.Panels@63017af3; Cannot create property=action for JavaBean=org.clapper.sbt.izpack.Panel@11f518d3; Cannot create property=id for JavaBean=org.clapper.sbt.izpack.Action@7552cf3b; Unable to find property 'id' on class: org.clapper.sbt.izpack.Action

I miss at least the line number.

IzPacked installer does not install my application.

I had izpack set up for maven, and I had an izpack installer easily created by it. My install.xml is below.

<?xml version="1.0" encoding="UTF-8"?>
<installation version="1.0">
    <info>
        <appname>OpenMOLE</appname>
        <appversion>$VERSION$</appversion>
        <uninstaller write="yes" />
        <javaversion>1.7</javaversion>
        <pack200 />
    </info>

    <packs>
        <pack name="OpenMOLE Core" required="yes">
        <description>"OpenMOLE Core</description>
            <fileset dir="../openmole/" targetdir="$INSTALL_PATH" />
            <file src="register.bat" targetdir="$INSTALL_PATH" override="true" />
    </pack>
        <pack name="OpenMOLE Runtime" required="yes">
        <description>"OpenMOLE Runtime</description>
            <file src="../dependency/org.openmole.runtime.tar.gz" targetdir="$USER_HOME/.openmole/runtime/" />
            <file src="../jvm-linux-x64.tar.gz" targetdir="$USER_HOME/.openmole/runtime/" />
            <file src="../jvm-linux-i386.tar.gz" targetdir="$USER_HOME/.openmole/runtime/" />
    </pack>
        <pack name="OpenMOLE Icons" required="yes">
        <description>"OpenMOLE Icons</description>
            <file src="./openmole.ico" targetdir="$INSTALL_PATH/" />
            <file src="./openmole-uninstall.ico" targetdir="$INSTALL_PATH/" />
            <file src="./openmole.png" targetdir="$INSTALL_PATH/" />
            <file src="./openmole-uninstall.png" targetdir="$INSTALL_PATH/" />
        <executable targetfile="$INSTALL_PATH/openmole" stage="never" />
        </pack>

    </packs>

    <resources>
        <res id="LicencePanel.licence" src="AGPLv3.txt"/>
        <res id="shortcutSpec.xml" src="shortcutSpec.xml" /> 
        <res id="Unix_shortcutSpec.xml" src="Unix_shortcutSpec.xml" /> 
    <!--<res id="ProcessPanel.Spec.xml" src="processPanelSpec.xml" />-->
    </resources>

    <panels>
        <panel classname="HelloPanel" />
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel" />
        <panel classname="InstallPanel" />
        <panel classname="ShortcutPanel"/>
    <!--<panel classname="ProcessPanel" />-->
        <panel classname="SimpleFinishPanel" />
    </panels>

    <locale>
        <langpack iso3="eng"/>
    </locale>

    <guiprefs resizable="yes" width="640" height="480" />

    <native type="izpack" name="ShellLink.dll" />

</installation>

I converted it to the install.yml below.

info:
    appName: OpenMOLE
    appVersion: $version
    createUninstaller: yes
    javaVersion: 1.7
    runPrivileged:
        enabled: no
    pack200: yes

packs:
    pack:
        name: OpenMOLE Core
        required: yes
        description: OpenMOLE Core
        fileset:
            includes: $installSourceDir/openmole/
            targetDir: $INSTALL_PATH
        file:
            src: $installSourceDir/resources/register.bat
            targetDir: $INSTALL_PATH/register.bat
            override: true
    pack:
        name: OpenMOLE Runtime
        required: yes
        description: OpenMOLE Runtime
        file:
            src: $installSourceDir/runtime/runtime.tar.gz
            targetDir: $USER_HOME/.openmole/runtime/
        file:
            src: $installSourceDir/runtime/jvm-x64.tar.gz
            targetDir: $USER_HOME/.openmole/runtime/
        file:
            src: $installSourceDir/runtime/jvm-386.tar.gz
            targetDir: $USER_HOME/.openmole/runtime/
    pack:
        name: OpenMOLE Icons
        required: yes
        description: OpenMOLE Icons
        file:
            src: $installSourceDir/resources/openmole.ico
            targetDir: $INSTALL_PATH/openmole.ico
            override: true
        file:
            src: $installSourceDir/resources/openmole-uninstall.ico
            targetDir: $INSTALL_PATH/openmole-uninstall.ico
            override: true
        file:
            src: $installSourceDir/resources/openmole.png
            targetDir: $INSTALL_PATH/openmole.png
            override: true
        file:
            src: $installSourceDir/resources/openmole-uninstall.png
            targetDir: $INSTALL_PATH/openmole-uninstall.png
            override: true
        executable:
            targetFile: $INSTALL_PATH/openmole
            stage: never

resources:
    resource:
        id: LicencePanel.licence
        src: $installSourceDir/resources/AGPLv3.txt
    resource:
        id: shortcutSpec.xml
        src: $installSourceDir/resources/shortcutSpec.xml
    resource:
        id: Unix_shortcutSpec.xml
        src: $installSourceDir/resources/Unix_shortcutSpec.xml

panels:
    panel:
        className: HelloPanel
    panel:
        className: LicencePanel
    panel:
        className: TargetPanel
    panel:
        className: InstallPanel
    panel:
        className: ShortcutPanel
    panel:
        className: SimpleFinishPanel

languages:
    - eng

guiprefs:
    resizable: yes
    width: 640
    height: 480

There are two problems with this. First, I cannot figure out how to add the custom XML for my native element in the xml. Second, sbt-izpack parses this yml and my settings just fine, and produces a 156MB installer.jar, but when I run that jar it only unpacks the uninstaller jar. Nothing else is put in the targetDirs. What is going on? Does my yaml have a bug in it?

Cannot create property=parsable / type

I have this snippet in izpack.yml:

packs:
  pack:
    name: Base
    required: yes
    preselected: yes
    description: My pack
    parsable:
      targetFile: $INSTALL_PATH/webIma/config/config.xml
      type: xml

and this is the generated error:

org.clapper.sbt.izpack.IzPluginException: null; Can't construct a java object for tag:yaml.org,2002:org.clapper.sbt.izpack.IzPackYamlConfig; exception=Cannot create property=packs for JavaBean=org.clapper.sbt.izpack.IzPackYamlConfig@6ee60cdb; Cannot create property=pack for JavaBean=org.clapper.sbt.izpack.Packs@5bbd61d; Cannot create property=parsable for JavaBean=org.clapper.sbt.izpack.Pack@611a4d19; Cannot create property=type for JavaBean=org.clapper.sbt.izpack.Parsable@71f0732f; Unable to find property 'type' on class: org.clapper.sbt.izpack.Parsable
        at org.clapper.sbt.izpack.Util$class.izError(util.scala:87)
        at org.clapper.sbt.izpack.IzPackYamlConfigParser.izError(Yaml.scala:297)
        at org.clapper.sbt.izpack.IzPackYamlConfigParser.parse(Yaml.scala:333)
        at org.clapper.sbt.izpack.IzPack$.org$clapper$sbt$izpack$IzPack$$createXML(IzPack.scala:261)
        at org.clapper.sbt.izpack.IzPack$$anonfun$org$clapper$sbt$izpack$IzPack$$createXMLTask$1.apply(IzPack.scala:237)
        at org.clapper.sbt.izpack.IzPack$$anonfun$org$clapper$sbt$izpack$IzPack$$createXMLTask$1.apply(IzPack.scala:235)

It doesn't like the type: xml, even though the documentation says it is valid!!!

$USER_HOME is not supported by the parser.

USER_HOME is an izpack built in variable. Your yaml parser will try to find a sbt definition for it, fail, and replace it with nothing. I can escape this with \$USER_HOME for now.

I miss the fileset/@dir attribute

I need to specify a base directory for reading resources.

e.g.:
From directory /home/d/project/a/b, I need to copy the folder "c" to $INSTALL_PATH/d/, except the c/e.
In IzPack XML it's very easy to do so:

<fileset dir='/home/d/project/a/b' includes='c' targetdir='$INSTALL_PATH/d/'>
   <include name='c/**'/>
   <exclude name="e"/>
</fileset>

A need a base directory for referencing nested excludes and includes.
The provided syntax can be clumsy, when you have to specify a lot of includes and excludes.

fileset:
   includes: /home/d/project/a/b/**
   excludes:  /home/d/project/a/b/e/**

instead of:

fileset:
   dir:  /home/d/project/a
   includes: b/**
   excludes:  e/**

How can I do it with sbt-izpack?

Doesn't work under SBT 0.13.7

When trying to use your plugin under SBT 0.13.7, I get this error:

[info] Resolving org.clapper#sbt-izpack;0.3.4.2 ...
[warn]  module not found: org.clapper#sbt-izpack;0.3.4.2
[warn] ==== typesafe-ivy-releases: tried
[warn]   https://repo.typesafe.com/typesafe/ivy-releases/org.clapper/sbt-izpack/scala_2.10/sbt_0.13/0.3.4.2/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn]   https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.clapper/sbt-izpack/scala_2.10/sbt_0.13/0.3.4.2/ivys/ivy.xml
[warn] ==== local: tried
[warn]   /home/d/.ivy2/local/org.clapper/sbt-izpack/scala_2.10/sbt_0.13/0.3.4.2/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/clapper/sbt-izpack_2.10_0.13/0.3.4.2/sbt-izpack-0.3.4.2.pom
[warn] ==== sbt-plugin-releases: tried
[warn]   http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/org.clapper/sbt-izpack/scala_2.10/sbt_0.13/0.3.4.2/ivys/ivy.xml
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.clapper#sbt-izpack;0.3.4.2: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]          org.clapper:sbt-izpack:0.3.4.2 (sbtVersion=0.13, scalaVersion=2.10)

The contents of my project/plugins.sbt is the recommended one:

addSbtPlugin("org.clapper" % "sbt-izpack" % "0.3.4.2")

resolvers += Resolver.url(
    "sbt-plugin-releases",
    new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/")
)(Resolver.ivyStylePatterns)

Autoplugin and subprojects

I have a root project and many subprojects.

When I do:

sbt root/izpack:create-xml

or

sbt izpack:create-xml

It tries to create target/izpack.xml from src/izpack/izpack.iml, but also it searches for subproject1/src/izpack/izpack.iml and subproject2/src/izpack/izpack.iml. As I only have one izpack.iml, it fails.

I think it's a bug that has to do with the new 0.13 support.

Actions of a panel don't work

I've seen that generate izpack.xml contains:

<panel id="...">
      <action stage="preactivate" classname="mypackage.MyClass"/>
</panel>

But the IzPack documentation states this format:

<panel id="...">
       <actions>
           <action stage="preactivate" classname="mypackage.MyClass"/>
       </actions>
</panel>

I think this could be the cause of actions not to work.

Exclude rule that begins with /** takes very long

If I write this, it takes too long:

fileset:
  includes: $dirWebapp/**
  excludes: /**/*.py
  targetDir: $INSTALL_PATH/webIma

I have to write this redundant style instead:

fileset:
  includes: $dirWebapp/**
  excludes: $dirWebapp/**/*.py
  targetDir: $INSTALL_PATH/webIma

What is worst, in the 2nd case, no exclude rule is generated in the generated izpack.xml. It is also quite verbose, listing all the subdirectories.

Variable replacement at compile time or run time?

The doc states the following:

You can define any number of variables. If the plugin logic encounters a variable that isn’t defined, 
it simply replaces the variable reference with an empty string (like bash does).

But some variables like $INSTALL_PATH, aren't handled this way.

I have some variables that are entered by the user, like some custom destination directories:

        <fileset dir="tmp" targetdir="$dirWeb" override="true">
            <include name="js/**"/>
            <exclude name="js/**/*uncompressed*"/>
            <exclude name="js/build-report.txt"/>
            <exclude name="**/README"/>
        </fileset>

In this example, I don't want the variable $dirWeb to be replaced by a blank, but let IzPack do the substitution at run time. I need to be handled exactly like INSTALL_PATH.

How can this be done?

appJar variable is not expanded correctly.

I am using 1.0.0

When I inspect the izpack.xml I see the appJar variable expanded incorrectly:

<variable name="appJar" value="C:\scm\incubator\scala-daemon-example\target\scala-2.11\[email protected]"/>

It looks like the version property is being incorrectly substituted with the property name itself instead of name.value.

Indeed this looks to be the case in Izpack.scala:

val jarName = "%s_%s-%s.jar" format (normalizedName.value,
                                       scalaVersion.value,
                                       version)
val appJar = FileUtil.joinPath(classesParent, jarName)

When upgrading to sbt-izpack 1.0 cannot use IzPack.settings

In my build.sbt I have this line:

IzPack.settings

It used to work before.

But now, I get this error:

build.sbt:349: error: value settings is not a member of sbt.Configuration
IzPack.settings

Maybe some import or some prefix is necessary.

When using previous version, installed locally, it used to work.

NullPointerException for missing properties of an action

When I forget to specify action properties, I receive this exception:

java.lang.NullPointerException
    at org.clapper.sbt.izpack.XMLable$$anonfun$seqToXML$1.apply(Yaml.scala:151)
    at org.clapper.sbt.izpack.XMLable$$anonfun$seqToXML$1.apply(Yaml.scala:151)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at org.clapper.sbt.izpack.XMLable$class.seqToXML(Yaml.scala:151)
    at org.clapper.sbt.izpack.Panel.seqToXML(Yaml.scala:834)
    at org.clapper.sbt.izpack.Panel.sectionToXML(Yaml.scala:861)
    at org.clapper.sbt.izpack.IzPackSection$class.toXML(Yaml.scala:233)
    at org.clapper.sbt.izpack.Panel.toXML(Yaml.scala:834)
    at org.clapper.sbt.izpack.Panels$$anonfun$sectionToXML$5.apply(Yaml.scala:829)

instead of a self-explanatory error message.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.