簡體   English   中英

下載-Maven-插件拋出IllegalArgumentException

[英]download-maven-plugin throws IllegalArgumentException

當我嘗試使用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]

我目前遇到同樣的問題。 我發現,刪除.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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM