0

I have created NSIS script for my java project.I have installed nsis plugin in my eclipse.using plugin I have created nsi file.Now i want to compile the nsi file.I have try to using Ant in eclipse.

<?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="nsis" basedir=".">
    <property name="build.path" value="build"/> 
        <property name="deploy.dir" value="/opt/test"></property>
    <path id="library.classpath">
            <fileset dir="lib">
                <include name="nsisant-1.2.jar"/>
            </fileset>
        </path>
    <target name="nsis" description="compile nsis script">
        <mkdir dir="${build.path}/nsis"/>
        <nsis script="setup.nsi">
            <classpath refid="library.classpath"/>
        </nsis>
    </target>
    </project>

But it throws following error.

 BUILD FAILED
    build.xml:12: Problem: failed to create task or type nsis
    Cause: The name is undefined.
    Action: Check the spelling.
    Action: Check that any custom tasks/types have been declared.
    Action: Check that any <presetdef>/<macrodef> declarations have taken place.

I dont know why this happen?? How to compile nsi file using ant? or Is there any other way there to compile without using ant?

Seki
  • 11,135
  • 7
  • 46
  • 70
Ami
  • 4,241
  • 6
  • 41
  • 75

2 Answers2

2

Using a dedicated nsis task seems to be the best way, but maybe not the simplest. I just execute makensis.exe using such syntax:

<exec executable="C:\Program_Files\NSIS\makensis.exe" failonerror="true" >
  <!-- providing some nsis definitions -->
  <arg value="/DPROJECT_NAME=${ant.project.name}"/>
  <!-- passing the script -->
  <arg value="${basedir}\raport.nsi"/>
</exec>

As for your second question: yes, you can compile nsis script without ant. For example:

C:\Program_Files\NSIS\makensis.exe /DPROJECT_NAME=this-project my-script.nsi

Being on Linux you also should have makensis somewhere.

The PROJECT_NAME stuff is my customization. In simplest case you don't supply any definitions, omitting that part.

Jarekczek
  • 7,456
  • 3
  • 46
  • 66
  • thanks.where am i getting makensis.exe file? I have searched google could not get it.Is it Download file? can you provide me any link or tell me how to use makensis.exe? – Ami Oct 31 '12 at 04:10
  • Thanks.i have downloaded.In the above script for working both windows and linux? only for linux? – Ami Oct 31 '12 at 06:49
  • On Linux you must use wine or build it yourself. See this question: [NSIS support for Linux and Solaris](http://stackoverflow.com/q/2324575/772981). – Jarekczek Oct 31 '12 at 06:55
  • failonerror="true" what's the use of this tag? can you tell me? – Ami Oct 31 '12 at 08:14
  • 1
    I'll gladly help you with the things that are hard to find. But I won't read the manual for you. Google for "exec task". – Jarekczek Oct 31 '12 at 08:18
1

Do you use the NSIS Ant Task from the Nsis Ant Sourceforge project? Once installed, you can use it as

<taskdef name="nsis" classname="net.sf.nsisant.Task">
    <classpath location="nsisant-{version}.jar">
</taskdef>
Seki
  • 11,135
  • 7
  • 46
  • 70
  • what did you mean to this "Once installed".now i have nsis script only.then how can i install?? Through ant i want to compile the script after only i'm going to install.can you please tell clearly? – Ami Oct 30 '12 at 09:23
  • Installed = the nsisant jar file must just be somewhere in the classpath – Seki Oct 30 '12 at 09:49
  • thanks.If i run this script whether i need makensis.exe file or not? if its required then how can i get that makensis.exe file?. – Ami Oct 31 '12 at 04:14