Ant-Task for 7z

richtich, genau so habe ich es auch gemacht, aber ich habe noch eine andere Frage.

kann ich eigentlich mit einem ant-script nur actionen ausführen, die in diesem Ordner sind oder kann ich auch die zwischen Ordnern wechseln und an beliebigen Orten .bat ausfürhen lassen, bzw. an in den verschieden Ordnern actionen ausführen
 
Ich weiß net was ich falsch mache, vielleicht sieht ja einer von euch den fehler.

Anttarget:
Code:
<target name="compile">
		<property name="jarpath" value="jar"/>
		<property name="compilefile" value="${jarpath}\compile.bat"/>
		<exec executable="${compilefile}">
			<arg value="${jarpath}/compile install.xml -b . -o install.jar -k standard"/>
		</exec>
	</target>

Ausgabe:
Buildfile: c:\installer\build.xml

compile:

[exec] .:: IzPack - Version 3.9.0 ::.

[exec] < compiler specifications version : 1.0 >

[exec] - Copyright (C) 2001-2006 Julien Ponge
[exec] - Visit http://www.izforge.com/ for the latests releases
[exec] - Released under the terms of the Apache Software License version 2.0.

[exec] -> Processing : jar/compile install.xml -b . -o install.jar -k standard
[exec] -> Output : jar/compile install.xml -b . -o install.jar -k standjar
[exec] -> Base path : .
[exec] -> Kind : standard
[exec] -> Compression : default
[exec] -> Compr. level: -1
[exec] -> IzPack home : .

[exec] -> Fatal error :
[exec] Invalid file: C:\installer\jar\compile install.xml -b . -o install.jar -k standard
[exec] com.izforge.izpack.compiler.CompilerException: Invalid file: C:\installer\jar\compile install.xml -b . -o install.jar -k standard
[exec] at com.izforge.izpack.compiler.CompilerConfig.getXMLTree(CompilerConfig.java:1360)
[exec] at com.izforge.izpack.compiler.CompilerConfig.executeCompiler(CompilerConfig.java:306)
[exec] at com.izforge.izpack.compiler.CompilerConfig.main(CompilerConfig.java:1854)
[exec] at com.izforge.izpack.compiler.Compiler.main(Compiler.java:615)

[exec] (tip : use -? to get the commmand line parameters)

init:
BUILD SUCCESSFUL

BUILD SUCCESSFUL
Total time: 0 seconds
 
Hallo,

In der Doku (http://ant.apache.org/manual/CoreTasks/exec.html) steht doch drin, dass
.bat / .cmd Files über cmd /c gestartet werden müssen:
Windows Users

The <exec> task delegates to Runtime.exec which in turn apparently calls ::CreateProcess. It is the latter Win32 function that defines the exact semantics of the call. In particular, if you do not put a file extension on the executable, only ".EXE" files are looked for, not ".COM", ".CMD" or other file types listed in the environment variable PATHEXT. That is only used by the shell.
Note that .bat files cannot in general by executed directly. One normally needs to execute the command shell executable cmd using the /c switch.



Gruß Tom
 
Zurück