运行maven任务时出错

时间:2017-02-28 16:16:01

标签: java maven maven-3 maven-plugin maven-clean-plugin

我正在使用maven来构建我的应用程序。 当我试图运行干净安装时它给了我错误,但同样的事情在我朋友的电脑上工作正常。 不同之处在于他在使用java 7时正在使用java 8。 这是我的调试日志:

  Apache Maven 3.0.4 (r1232337; 2012-01-17 14:14:56+0530)
Maven home: /home/nitin/Soft/apache-maven-3.0.4
Java version: 1.8.0_101, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-21-generic", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /home/nitin/Soft/apache-maven-3.0.4/conf/settings.xml
[DEBUG] Reading user settings from /home/nitin/.m2/settings.xml
[DEBUG] Using local repository at /home/nitin/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /home/nitin/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.example:example:war:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging war from ClassRealm[plexus.core, parent: null]
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.example:example:war:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.maxmind:geoIp:jar should not point at files within the project directory, ${project.basedir}/lib/geoIp.jar will be unresolvable by dependent projects @ line 567, column 16
[WARNING] 'dependencies.dependency.systemPath' for org.terracotta:ehcache-probe:jar should not point at files within the project directory, ${project.basedir}/lib/ehcache-probe-1.0.3.jar will be unresolvable by dependent projects @ line 574, column 16
[WARNING] 'dependencies.dependency.systemPath' for com.sforce:enterprise:jar should not point at files within the project directory, ${project.basedir}/lib/enterprise.jar will be unresolvable by dependent projects @ line 581, column 16
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.example:example:war:0.0.1-SNAPSHOT
[DEBUG] Tasks:   [clean, install]
[DEBUG] Style:   Regular
[DEBUG] =======================================================================
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building example.com :: example en España 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[WARNING] The POM for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model
[FATAL] Non-parseable POM /home/nitin/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom: end tag name </body> must match start tag name <hr> from line 888 (position: START_TAG seen ...          08-Nov-2014 19:04                 207\r\n</pre><hr></body>... @888:18)  @ line 888, column 18

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.289s
[INFO] Finished at: Tue Feb 28 21:39:22 IST 2017
[INFO] Final Memory: 7M/119M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to parse plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.4.1 (/home/nitin/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.jar): error in opening zip file -> [Help 1]
org.apache.maven.plugin.PluginDescriptorParsingException: Failed to parse plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.4.1 (/home/nitin/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.jar): error in opening zip file
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.extractPluginDescriptor(DefaultMavenPluginManager.java:212)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:147)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:152)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:139)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:116)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:129)
    at org.apache.maven.lifecycle.internal.BuilderCommon.resolveBuildPlan(BuilderCommon.java:92)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    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.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:219)
    at java.util.zip.ZipFile.<init>(ZipFile.java:149)
    at java.util.jar.JarFile.<init>(JarFile.java:166)
    at java.util.jar.JarFile.<init>(JarFile.java:145)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.extractPluginDescriptor(DefaultMavenPluginManager.java:170)
    ... 25 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] 

在清理我的.m2导演后我也尝试过,但它没有帮助我。

我的Pom文件如下:

<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.example</groupId>
    <artifactId>example</artifactId>
    <packaging>war</packaging>
    <name>example.com :: example en España</name>
    <version>0.0.1-SNAPSHOT</version>

    <url>http://www.example.com/</url>

    <description>
        example.com, la red de example recomendados.
    </description>

    <organization>
        <name>example Directories S.L.</name>
    </organization>

    <properties>
        <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>

    </properties>
    <dependencies>  

    </dependencies>

    <repositories>
        <repository>
            <id>springsource-external</id>
            <name>SpringSource Enterprise Bundle Repository - External Bundle
                Releases</name>
            <url>http://repository.springsource.com/maven/bundles/external</url>
        </repository>
        <repository>
            <id>springsource-releases</id>
            <name>SpringSource Enterprise Bundle Repository - SpringSource Bundle
                Releases</name>
            <url>http://repository.springsource.com/maven/bundles/release</url>
        </repository>
        <repository>
            <id>Maven-central</id>
            <name>Maven central</name>
            <url>http://repo1.maven.org/maven2</url>
        </repository>
        <!--<url>http://search.maven.org</url>-->
        <repository>
            <id>java</id>
            <name>Java.net releases</name>
            <url>http://download.java.net/maven/2/</url>
        </repository>
        <repository> 
            <id>terracotta-releases</id> 
            <url>http://www.terracotta.org/download/reflector/releases</url> 
        </repository>
        <repository> 
            <id>eonic-repo</id> 
            <url>http://repo.enonic.com/maven</url> 
        </repository>
        <repository>
            <id>spring.social.google</id>
            <name>Spring Social Google</name>
            <url>http://github.com/GabiAxel/maven/raw/master/</url>
        </repository>
        <repository>
            <id>spring-source-milestones</id>
            <name>SpringSource Milestones Proxy</name>
            <url>http://oss.sonatype.org/content/repositories/springsource-milestones</url>
        </repository>
        <repository>
             <id>msel.snapshot</id>
             <name>Johns Hopkins Sheridan Libraries Maven 2 Repository</name>
            <url>http://maven.mse.jhu.edu/m2repository/</url>
        </repository>
        <repository>
            <id>bitwalker.user-agent-utils.mvn.repo</id>
            <url>http://raw.githubusercontent.com/HaraldWalker/user-agent-utils/mvn-repo/</url>
            <!-- use snapshot version -->
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
        <repository>
            <id>central</id>
            <name>bintray</name>
            <url>http://jcenter.bintray.com</url>
        </repository>
        <repository>
            <id>jitpack.io</id>
            <url>http://jitpack.io</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>ibiblio</id>
            <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>fusesource</id>
            <name>Fuse Source releases</name>
            <url>http://repo.fusesource.com/maven2/</url>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <finalName>example</finalName>
        <resources>

        </resources>

        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                 <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                    <resourceEncoding>${project.build.sourceEncoding}</resourceEncoding>
                    <warName>${build.warname}</warName>
                    <webResources>
                        <resource>
                            <directory>src/main/resources/context</directory>
                            <filtering>true</filtering>
                            <targetPath>META-INF</targetPath>
                        </resource>
                        <resource>
                            <directory>src/main/webapp/WEB-INF</directory>
                            <filtering>true</filtering>
                            <targetPath>WEB-INF</targetPath>
                        </resource>
                    </webResources>
                    <warSourceExcludes>/assets/css/**.css, /assets/css/*/**.css, /assets/js/**.js, /assets/js/*/**.js, /assets/js/*/*/**.js</warSourceExcludes>
                </configuration>
            </plugin>   
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <configuration>
                            <tasks>
                                <copy file="lib/geoIp.jar" tofile="${project.build.directory}/example/WEB-INF/lib/geoIp.jar" />
                                <copy file="lib/ehcache-probe-1.0.3.jar" tofile="${project.build.directory}/example/WEB-INF/lib/ehcache-probe-1.0.3.jar" />
                                <copy file="lib/enterprise.jar" tofile="${project.build.directory}/example/WEB-INF/lib/enterprise.jar" />
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-antrun-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.3,)
                                        </versionRange>
                                        <goals>
                                            <goal>run</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

1 个答案:

答案 0 :(得分:0)

检查您的settings.xml。鉴于您在this comment上描述的错误,您的镜像或存储库似乎正在重定向到HTTP站点,返回HTML而不是XML。