发生了Ant BuildException:未找到Jar的目录:

时间:2016-03-04 20:13:41

标签: maven ant javafx-8 maven-3

当我尝试运行mvn clean pacakge时,我无法弄清楚为什么会看到此错误。 它肯定与目录路径。有人帮我指出我做错的地方。

这是我关注http://myjavafx.blogspot.com/2012/08/building-signing-and-deploying-your.html

的帖子
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project jnlptest: An Ant BuildException has occured: Jar's directory not found: C:\mywork\EclipseWorkspace\jnlptest\target\dist\lib
[ERROR] around Ant part ...<manifestclasspath jarfile="C:\mywork\EclipseWorkspace\jnlptest\target\dist\lib\jnlptest-0.0.1-SNAPSHOT.jar" property="manifest.classpath">... @ 8:142 in C:\mywork\EclipseWorkspace\jnlptest\target\antrun\build-main.xml
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project jnlptest: An Ant BuildException has occured: Jar's directory not found: C:\mywork\EclipseWorkspace\jnlptest\target\dist\lib
around Ant part ...<manifestclasspath jarfile="C:\mywork\EclipseWorkspace\jnlptest\target\dist\lib\jnlptest-0.0.1-SNAPSHOT.jar" property="manifest.classpath">... @ 8:142 in C:\mywork\EclipseWorkspace\jnlptest\target\antrun\build-main.xml
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: Jar's directory not found: C:\mywork\EclipseWorkspace\jnlptest\target\dist\lib
around Ant part ...<manifestclasspath jarfile="C:\mywork\EclipseWorkspace\jnlptest\target\dist\lib\jnlptest-0.0.1-SNAPSHOT.jar" property="manifest.classpath">... @ 8:142 in C:\mywork\EclipseWorkspace\jnlptest\target\antrun\build-main.xml
    at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:355)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 20 more

继承我的Pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.plugin</groupId>
    <artifactId>jnlptest</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>jnlptest</name>
    <organization>
        <name>Jnlp</name>
    </organization>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <javafx.lib.ant-javafx.jar>C:\Program Files\Java\jdk1.8.0_66\lib\ant-javafx.jar</javafx.lib.ant-javafx.jar>
        <application.dist>${project.build.directory}\dist</application.dist>
    </properties>

        <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeScope>runtime</includeScope>
                            <outputDirectory>${application.dist}/lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <configuration>
                            <target xmlns:fx="javafx:com.sun.javafx.tools.ant">
                                <property name="applet.width" value="330" />
                                <property name="applet.height" value="620" />
                                <property name="application.title" value="Title" />
                                <property name="application.vendor" value="Vendor" />
                                <!-- Copy the class path to the manifest. The lib folder is generated 
                                    by maven-dependency-plugin. -->


                                <manifestclasspath property="manifest.classpath"
                                    jarfile="${application.dist}\lib\jnlptest-0.0.1-SNAPSHOT.jar">
                                    <classpath>
                                        <path id="build.classpath">
                                            <fileset dir="${application.dist}\lib">
                                                <include name="*.jar" />
                                            </fileset>
                                        </path>
                                    </classpath>
                                </manifestclasspath>





                                <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
                                    uri="javafx:com.sun.javafx.tools.ant" classpath="${javafx.lib.ant-javafx.jar}" />

                                <fx:application id="myApp" name="MyApp"
                                    mainClass="com.plugin.jnlptest.DockMain" />

                                <fx:jar destfile="${application.dist}\lib\jnlptest-0.0.1-SNAPSHOT.jar">
                                    <fx:application refid="myApp" />
                                    <manifest>
                                        <attribute name="Class-Path" value="${manifest.classpath}" />
                                    </manifest>
                                    <!-- The target/classes folder which contains all resources and 
                                        class files -->
                                    <fileset dir="${project.build.outputDirectory}" />
                                </fx:jar>
                                <fx:resources id="appRes">
                                    <fx:fileset dir="${application.dist}" includes="*.jar" />
                                    <fx:fileset dir="${application.dist}" includes="lib\*.jar" />
                                </fx:resources>
                            <!--    <signjar keyStore="${basedir}\keystore.jks" destdir="${application.dist}"
                                    alias="certificatekey" storePass="cshcsh" keyPass="cshcsh">
                                    <fileset dir="${application.dist}" includes="*.jar" />
                                    <fileset dir="${application.dist}" includes="lib/*.jar" />
                                </signjar> -->
                                <fx:deploy width="${applet.width}" height="${applet.height}"
                                    outdir="${application.dist}" embedJNLP="true" outfile="${application.title}">
                                <fx:application refId="myApp" />
                                    <fx:resources refid="appRes" />
                                    <fx:info title="Sample app: ${application.title}"
                                        vendor="${application.vendor}" />

                                    <!-- Request elevated permissions -->
                                    <fx:permissions elevated="true" />
                                </fx:deploy>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>

0 个答案:

没有答案