1

在更新该项目之前,我有一个在 Eclipse 3.4.2 中运行良好的 maven 项目。

OS:  Windows XP, SP2
Maven:  maven-2.2.1
Java:   jdk1.6.0_17

Eclipse: 3.4.2
m2e:     0.9.8

当我从 Eclipse 执行以下操作时:(1)maven clean,然后(2)maven install;

安装失败。这是日志的一部分。

    [INFO] Installing C:\DLiao\Archive_Reconciler\R18\app\target\tsi-apex-reconciler-app-1.0.18.jar to C:\Documents and Settings\DLiao\.m2\repository\net\transolutions\apex\tsi-apex-reconciler-app\1.0.18\tsi-apex-reconciler-app-1.0.18.jar
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Transolutions Apex Reconciler Web Application
    [INFO] 
    [INFO] Id: net.transolutions.apex:tsi-apex-reconciler-web:war:1.0.18
    [INFO] task-segment: [install]
    [INFO] ------------------------------------------------------------------------
    [INFO] [resources:resources]
    [INFO] Using default encoding to copy filtered resources.
    [INFO] [compiler:compile]
    [INFO] No sources to compile
    [INFO] [resources:testResources]
    [INFO] Using default encoding to copy filtered resources.
    [INFO] [compiler:testCompile]
    [INFO] No sources to compile
    [INFO] [surefire:test]
    [INFO] No tests to run.
    [INFO] [war:war]
    [INFO] Packaging webapp
    [INFO] Assembling webapp[tsi-apex-reconciler-web] in [C:\DLiao\Archive_Reconciler\R18\web\target\tsi-apex-reconciler-web-1.0.18]
    [INFO] Processing war project
    [INFO] 
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] ------------------------------------------------------------------------
    [INFO] Transolutions Apex Reconciler ......................... SUCCESS [0.672s]
    [INFO] Transolutions Apex Reconciler Data Layer .............. SUCCESS [1.672s]
    [INFO] Transolutions Apex Reconciler Render Service Client ... SUCCESS [0.188s]
    [INFO] Transolutions Apex Reconciler Application Layer ....... SUCCESS [1.250s]
    [INFO] Transolutions Apex Reconciler Web Application ......... FAILED [1.718s]
    [INFO] ------------------------------------------------------------------------
    [ERROR] 

    *The following mojo encountered an error while executing:
    Group-Id: org.apache.maven.plugins
    Artifact-Id: maven-war-plugin
    Version: 2.1-alpha-1
    Mojo: war
    brought in via: packaging: war

    While building project:
    Group-Id: net.transolutions.apex
    Artifact-Id: tsi-apex-reconciler-web
    Version: 1.0.18
    From file: C:\DLiao\Archive_Reconciler\R18\web\pom.xml
    Reason: Failed to copy file for artifact[active project artifact:
        artifact = net.transolutions.apex:tsi-apex-reconciler-app:jar:1.0.18:compile;
        project: MavenProject: net.transolutions.apex:tsi-apex-reconciler-app:1.0.18 @ C:\DLiao\Archive_Reconciler\
R18\app\pom.xml]*



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run with the -e flag
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILED
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Wed Jan 02 14:14:19 CST 2013
[INFO] Final Memory: 3M/20M
[INFO] ------------------------------------------------------------------------

但是,如果我从 DOS 命令行(Java JDK 1.6.0_17)运行 mvn clean install ,一切都很好,并且 .war 罚款部署在我的 ~/m2/...

这是来自命令行的日志文件。

[INFO] Installing C:\DLiao\Archive_Reconciler\R18\app\target\tsi-apex-reconciler
-app-1.0.18.jar to C:\Documents and Settings\DLiao\.m2\repository\net\transoluti
ons\apex\tsi-apex-reconciler-app\1.0.18\tsi-apex-reconciler-app-1.0.18.jar
[INFO] ------------------------------------------------------------------------
[INFO] Building Transolutions Apex Reconciler Web Application
[INFO]    task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory C:\DLiao\Archive_Reconciler\R18\web\target
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] No sources to compile
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\DLiao\Archive_Reconciler\R18\web\s
rc\test\resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] No sources to compile
[INFO] [surefire:test {execution: default-test}]
[INFO] No tests to run.
[INFO] [war:war {execution: default-war}]
[INFO] Packaging webapp
[INFO] Assembling webapp[tsi-apex-reconciler-web] in [C:\DLiao\Archive_Reconcile
r\R18\web\target\tsi-apex-reconciler-web-1.0.18]
[INFO] Processing war project
[INFO] Copying webapp resources[C:\DLiao\Archive_Reconciler\R18\web\src\main\web
app]
[INFO] Webapp assembled in[1110 msecs]
[INFO] Building war: C:\DLiao\Archive_Reconciler\R18\web\target\tsi-apex-reconci
ler-web-1.0.18.war
[INFO] [install:install {execution: default-install}]
[INFO] Installing C:\DLiao\Archive_Reconciler\R18\web\target\tsi-apex-reconciler
-web-1.0.18.war to C:\Documents and Settings\DLiao\.m2\repository\net\transoluti
ons\apex\tsi-apex-reconciler-web\1.0.18\tsi-apex-reconciler-web-1.0.18.war
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Transolutions Apex Reconciler ......................... SUCCESS [1.172s]
[INFO] Transolutions Apex Reconciler Data Layer .............. SUCCESS [2.406s]
[INFO] Transolutions Apex Reconciler Render Service Client ... SUCCESS [0.328s]
[INFO] Transolutions Apex Reconciler Application Layer ....... SUCCESS [3.547s]
[INFO] Transolutions Apex Reconciler Web Application ......... SUCCESS [10.282s]

[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17 seconds
[INFO] Finished at: Wed Jan 02 11:23:10 CST 2013
[INFO] Final Memory: 49M/254M
[INFO] ------------------------------------------------------------------------

有什么建议,请指教。

谢谢戴夫

4

1 回答 1

0

父 POM 文件。

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

        <modelVersion>4.0.0</modelVersion>
        <properties>
            <reconciler.version>1.0.19</reconciler.version>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>

        <groupId>net.transolutions.apex</groupId>
        <artifactId>tsi-apex-reconciler</artifactId>
        <version>1.0.19</version>
        <packaging>pom</packaging>


        <name>Transolutions Apex Reconciler</name>
        <description>Update and reimplementation of the classic reconciler web application.</description>

    <modules>
      <module>data</module>
      <module>app</module>
      <module>web</module>
      <module>render-service</module>
    </modules>

    <build>
        <defaultGoal>install</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <verbose>true</verbose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
            </plugin>

        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Portfolio Snapshot Repository</name>
            <url>http://s3.amazonaws.com/maven.springframework.org/snapshot</url>
        </repository>        
        <repository>
            <id>maven.org</id>
            <name>Maven 2 Repository</name>
            <url>http://repo2.maven.org/maven2/</url>
        </repository>
        <repository>
            <id>jboss-maven2</id>
            <name>JBoss Maven 2 Repository</name>
            <url>http://repository.jboss.org/nexus/content/groups/public/</url>
        </repository>
        <repository>
            <id>java.net</id>
            <name>Java.net Maven Repository</name>
            <url>https://maven-repository.dev.java.net/nonav/repository/</url>
        </repository>        
    </repositories>
</project>

我的 Web 项目的 POM 文件,它会生成错误消息。

<?xml version="1.0" encoding="UTF-8"?>
<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">

    <parent>
        <groupId>net.transolutions.apex</groupId>
        <artifactId>tsi-apex-reconciler</artifactId>
        <version>1.0.19</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <groupId>net.transolutions.apex</groupId>
    <artifactId>tsi-apex-reconciler-web</artifactId>
    <packaging>war</packaging>

    <name>Transolutions Apex Reconciler Web Application</name>
    <description>Web application that assembles the data layer and application layer.</description>

    <properties>
        <icefaces.version>1.8.1</icefaces.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>net.transolutions.apex</groupId>
            <artifactId>tsi-apex-reconciler-app</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.icefaces</groupId>
            <artifactId>icefaces</artifactId>
            <version>${icefaces.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.el</groupId>
                    <artifactId>el-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.icefaces</groupId>
            <artifactId>icefaces-facelets</artifactId>
            <version>${icefaces.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.el</groupId>
                    <artifactId>el-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.icefaces</groupId>
            <artifactId>icefaces-comps</artifactId>
            <version>${icefaces.version}</version>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.3.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.9</version>
                <configuration>
                    <contextPath>/reconciler</contextPath>
                    <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                        <port>8080</port>
                        <maxIdleTime>3600000</maxIdleTime>
                    </connector>
                    <systemProperties>
                        <property>
                            <name>slf4j</name>
                            <value>false</value>
                        </property>
                        <property>
                            <name>log4j.configuration</name>
                            <value>file:${basedir}/src/main/webapp/WEB-INF/classes/log4j.properties</value>
                        </property>
                        <property>
                            <name>catalina.home</name>
                            <value>${basedir}/target/</value>
                        </property>
                        <property>
                            <name>catalina.base</name>
                            <value>${basedir}/target/</value>
                        </property>
                    </systemProperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <configuration>
                    <url>http://192.168.56.1:8080/manager/text</url>
                    <server>TomcatServer</server>
                    <path>/tsi-apex-reconciler-web-1.0.18</path>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>TEST</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <delete
                                            file="${project.build.outputDirectory}/environment.properties" />
                                        <copy file="src/main/resources/environment.test.properties"
                                            tofile="${project.build.outputDirectory}/environment.properties" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <classifier>test</classifier>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>PROD</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <delete file="${project.build.outputDirectory}/PROD.jdbc.properties" />
                                        <delete file="${project.build.outputDirectory}/PROD.jdbc.properties" />
                                        <delete file="${project.build.outputDirectory}//TEST.renderer.properties" />
                                        <delete file="${project.build.outputDirectory}//TEST.renderer.properties" />
                                        <delete file="${project.build.outputDirectory}/jdbc.properties" />
                                        <copy file="src/main/resources/PROD.jdbc.properties"
                                            tofile="${project.build.outputDirectory}/jdbc.properties" />
                                        <delete file="${project.build.outputDirectory}/renderer.properties" />
                                        <copy file="src/main/resources/PROD.renderer.properties"
                                            tofile="${project.build.outputDirectory}/renderer.properties" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>

希望这些会有所帮助。

最好的,戴夫

于 2013-01-02T23:22:33.143 回答