0

我已经为我的java项目创建了NSIS脚本。我已经在我的eclipse中安装了nsis插件。使用插件我已经创建了nsi文件。现在我想编译nsi文件。我尝试在eclipse中使用Ant。

<?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>

但它会引发以下错误。

 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.

我不知道为什么会这样??如何使用ant编译nsi文件?或者有没有其他方法可以在不使用 ant 的情况下进行编译?

4

2 回答 2

2

使用专门的nsis任务似乎是最好的方法,但也许不是最简单的。我只是makensis.exe使用这样的语法执行:

<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>

至于你的第二个问题:是的,你可以在没有 ant 的情况下编译 nsis 脚本。例如:

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

在 Linux 上,你也应该有makensis某个地方。

这些PROJECT_NAME东西是我的定制。在最简单的情况下,您不提供任何定义,省略该部分。

于 2012-10-30T14:29:54.127 回答
1

您是否使用Nsis Ant Sourceforge 项目中的 NSIS Ant 任务?安装后,您可以将其用作

<taskdef name="nsis" classname="net.sf.nsisant.Task">
    <classpath location="nsisant-{version}.jar">
</taskdef>
于 2012-10-30T09:12:10.850 回答