download-maven-plugin抛出IllegalArgumentException

时间:2016-03-24 16:53:14

标签: maven maven-plugin google-code

当我尝试使用com.googlecode.maven-download-plugin.download-maven-plugin:1.2.1以下载zip文件并解压缩时,我收到以下错误。当我将其下载到Windows或Unix机器时,我试图检查文件权限但是权限看起来很正常(-rw-r - r--)任何想法为什么会抛出这个错误?

<plugin>
    <groupId>com.googlecode.maven-download-plugin</groupId>
    <artifactId>download-maven-plugin</artifactId>
    <version>${download-maven-plugin.version}</version>
    <executions>
        <execution>
            <id>download-sample</id>
            <phase>initialize</phase>
            <goals>
                <goal>wget</goal>
            </goals>
            <configuration>
                <url>${sample-url}</url>
                <unpack>true</unpack>
                <outputDirectory>${project.build.directory}/kit</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>


[INFO] --- download-maven-plugin:1.2.1:wget (download-sample) @ sample-p2-create-and-mirror ---
[DEBUG] Cache is: /appl/home/.m2/repository/.cache/maven-download-plugin
[INFO] Got from cache: /appl/home/.m2/repository/.cache/maven-download-plugin/EXAMPLE.zip

[DEBUG] Expanding: /appl/home/jenkins/jobs/folder/workspace/sample/target/kit/EXAMPLE.zip into /appl/home/jenkins/jobs/folder/workspace/sample/target/kit
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.714 s
[INFO] Finished at: 2016-03-24T17:25:28+01:00

[INFO] Final Memory: 16M/641M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.googlecode.maven-download-plugin:download-maven-plugin:1.2.0:wget (download-sample) on project sample-p2-create-and-mirror: IO Error:  file mode must be 3 or 4 characters -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.googlecode.maven-download-plugin:download-maven-plugin:1.2.0:wget (download-sample) on project sample-p2-create-and-mirror: IO Error
    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:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132)
    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:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
    at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186)
    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:498)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoExecutionException: IO Error
    at com.googlecode.WGet.execute(WGet.java:260)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 30 more
Caused by: java.lang.IllegalArgumentException:  file mode must be 3 or 4 characters
    at org.codehaus.plexus.archiver.util.FilePermissionUtils.getFilePermissionFromMode(FilePermissionUtils.java:55)
    at org.codehaus.plexus.archiver.util.ArchiveEntryUtils.applyPermissionsWithJvm(ArchiveEntryUtils.java:133)
    at org.codehaus.plexus.archiver.util.ArchiveEntryUtils.chmod(ArchiveEntryUtils.java:61)
    at org.codehaus.plexus.archiver.zip.AbstractZipUnArchiver.extractFile(AbstractZipUnArchiver.java:238)
    at org.codehaus.plexus.archiver.zip.AbstractZipUnArchiver.extractFileIfIncluded(AbstractZipUnArchiver.java:185)
    at org.codehaus.plexus.archiver.zip.AbstractZipUnArchiver.execute(AbstractZipUnArchiver.java:149)
    at org.codehaus.plexus.archiver.AbstractUnArchiver.extract(AbstractUnArchiver.java:120)
    at com.googlecode.WGet.unpack(WGet.java:269)
    at com.googlecode.WGet.execute(WGet.java:255)
    ... 32 more
[ERROR]

1 个答案:

答案 0 :(得分:0)

此刻我遇到了同样的问题。我发现删除.m2\repository\.cache\download-maven-plugin后,插件再次成功运行。

我想我会像khmarbaise建议的那样改变插件。

编辑1

自从我发布这个答案下载插件后经常出现问题下载文件,我终于切换到 antrun 插件:

<artifactId>maven-antrun-plugin</artifactId>
<executions>
    <execution>
        <id>download</id>
        <phase>none</phase><!-- I didn't need to link to phase -->
        <goals>
            <goal>run</goal>
        </goals>
        <configuration>
            <target>
                <echo message="Download file http://fake-url.com/xxx" />
                <get src="http://fake-url.com/xxx" dest="${project.build.directory}/to-file-path.xxx" />
            </target>
        </configuration>
    </execution>