运行maven时出错(无法执行)

时间:2016-09-28 15:17:49

标签: java maven

我正在我的JAVA EE项目中运行maven,但是我收到了一个错误,即使我使用调试选项也不能解释太多

  

mvn clean install -Dmaven.test.skip = true -X

[ERROR] Failed to execute goal com.google.code.maven-replacer-plugin:maven-replacer-plugin:1.3.2:replace (default) on project deviceWeb: File 'C:\Development\Workspaces\EclipseWS\device-iot\device
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.code.maven-replacer-plugin:maven-replacer-plugin:1.3.2:replace (default) on project deviceWeb: File 'C:\Developmen
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        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: File 'C:\Development\Workspaces\EclipseWS\device-iot\deviceWeb\null' does not exist
        at com.google.code.maven_replacer_plugin.ReplacerMojo.execute(ReplacerMojo.java:198)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
Caused by: java.io.FileNotFoundException: File 'C:\Development\Workspaces\EclipseWS\device-iot\deviceWeb\null' does not exist
        at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:137)
        at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1102)
        at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1120)
        at com.google.code.maven_replacer_plugin.file.FileUtils.readFile(FileUtils.java:28)
        at com.google.code.maven_replacer_plugin.Replacer.replace(Replacer.java:23)
        at com.google.code.maven_replacer_plugin.ReplacerMojo.replaceContents(ReplacerMojo.java:232)
        at com.google.code.maven_replacer_plugin.ReplacerMojo.execute(ReplacerMojo.java:189)
        ... 22 more
[ERROR]
[ERROR]

检查pom.xml我看到的唯一文件就是这个,但它存在于Filesystem

 <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>maven-replacer-plugin</artifactId>
                <version>1.3.2</version>
                <executions>
                    <execution>
                        <!-- the replace should happen before the app is packaged -->
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>

                <configuration>
                    <includes>
                        <!-- replace the token in this file -->
                    </includes>
                        <include>target/deviceWeb/WEB-INF/jsp/template/footer.jsp</include>
                    <regex>false</regex>
                    <replacements>
                        <replacement>
                            <!-- the name of the token to replace -->
                            <token>CURRENT_VERSION_MAVEN</token>
                            <!-- replace it with the maven project version -->
                            <value>${project.version} (${buildNumber})</value>
                        </replacement>
                        <replacement>
                            <token>CURRENT_DATE_MAVEN</token>
                            <value>${maven.build.timestamp}</value>
                        </replacement>
                    </replacements>

                </configuration>
            </plugin>

POM.XML

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.tdk.iot</groupId>
    <artifactId>devices-private</artifactId>
    <packaging>pom</packaging>
    <name>devices-private</name>
    <version>2.0</version>
    <description></description>
    <url>https://webgate.com.tdk.iot/TDKnet/confluence/display/${project.artifactId}/Home</url>
    <scm>
        <connection>scm:git:https://webgate.com.tdk.iot/TDKnet/stash/scm/envdevices/devices-private-app.git</connection>
        <developerConnection>scm:git:https://webgate.com.tdk.iot/TDKnet/stash/scm/envdevices/devices-private-app.git</developerConnection>
        <url>https://webgate.com.tdk.iot/TDKnet/stash/projects/ENVdevices/repos/devices-private-app/browse</url>
    </scm>
    <issueManagement>
        <system>Jira</system>
        <url>https://webgate.com.tdk.iot/TDKnet/jira/browse/ENVdevices</url>
    </issueManagement>    
    <properties>
        <weblogic.version>10.3.3.0</weblogic.version>
        <junit.version>4.12</junit.version>
        <spring.version>3.2.6.RELEASE</spring.version>
        <spring.ws.version>1.5.8</spring.ws.version>
        <pattern.integration.tests>**/*IT.java</pattern.integration.tests>
        <pattern.dao.tests>**/*UTDAO.java</pattern.dao.tests>
        <module.relative.url>../../${project.artifactId}/target/site</module.relative.url>
    </properties>
    <modules>
        <module>devicesWeb</module>
        <module>devicesEar</module>
    </modules>
    <dependencies>
    </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <excludes>
                            <exclude>${pattern.integration.tests}</exclude>
                            <exclude>${pattern.dao.tests}</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.0</version>
                <!--
                <configuration>
                    <rules>
                        <DependencyConvergence/>
                    </rules>
                </configuration>
                -->
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.0</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>1.7</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.4.3</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.1.2</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includePom>true</includePom>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.8</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <!-- Only the modules will find the customized site template -->
                    <siteDirectory>${basedir}/../site/src</siteDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.6</version>
                <inherited>true</inherited>
                <configuration>
                    <forkMode>once</forkMode>
                </configuration>
            </plugin>
            <!-- To remove unwanted files generated on each run: called on phase "clean"  -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${basedir}</directory>
                            <includes>
                                <include>orizon_report*.html</include>
                                <include>*.log</include>
                                <include>*.xls</include>
                                <include>*.zip</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <formats>
                        <format>xml</format>
                        <format>html</format>
                    </formats>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <distributionManagement>
        <repository>
            <id>env-releases</id>
            <name>ENV</name>
            <url>https://webgate.com.tdk.iot/TDKnet/nexus/content/repositories/env/</url>
        </repository>
        <snapshotRepository>
            <id>env-snapshots</id>
            <name>ENV snapshots</name>
            <url>https://webgate.com.tdk.iot/TDKnet/nexus/content/repositories/env-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
</project>

0 个答案:

没有答案