使用maven构建Camel Restlet项目的问题?

时间:2014-02-22 18:11:18

标签: java spring maven apache-camel restlet

您好我正在为我的Camel Restlet项目构建一个WAR文件,以便在tomcat容器上运行,并且在构建项目时出现以下错误。我必须使用旧版本的apache camel,所以我无法从2.10版本更新: -

D:\camel-restlet-demo>mvn -e  package
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountere
d while processing the POMs:
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-express
ion:jar is missing. @ line 34, column 21

        at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBu
ilder.java:364)
        at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:637)
        at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven
.java:586)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:229)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
356)
[ERROR]
[ERROR]   The project org.apache.camel:crestlet-demo:2.10.0 (D:\camel-restlet-de
mo\pom.xml) has 1 error
[ERROR]     'dependencies.dependency.version' for org.springframework:spring-exp
ression:jar is missing. @ line 34, column 21
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildin
gException

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>

    <parent>
        <groupId>org.apache.camel</groupId>
        <artifactId>examples</artifactId>
        <version>2.10.0</version>
    </parent>

    <artifactId>crestlet-demo</artifactId>
    <packaging>war</packaging>
    <name>Camel :: Demo :: Restlet :: JDBC</name>
    <description>A demo on REST API with Camel Restlet</description>

    <repositories>
        <repository>
        <id>maven-restlet</id>
        <name>Public online Restlet repository</name>
        <url>http://maven.restlet.org</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-spring</artifactId>
        </dependency>        
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-restlet</artifactId>
        </dependency>
        <dependency>
            <groupId>org.restlet.jee</groupId>
            <artifactId>org.restlet.ext.spring</artifactId>
            <version>${restlet-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>
    </dependencies>

</project>

伙计们坚持这个非常糟糕。请帮忙

1 个答案:

答案 0 :(得分:0)

似乎examples神器已被破坏。删除parent标记并自行管理依赖项,例如:

<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>

<artifactId>crestlet-demo</artifactId>
<packaging>war</packaging>
<name>Camel :: Demo :: Restlet :: JDBC</name>
<description>A demo on REST API with Camel Restlet</description>

<properties>
    <camel-version>2.10.0</camel-version>
    <restlet-version>2.0.0</restlet-version>
    <derby-version>10.10.1.1</derby-version>
</properties>

<repositories>
    <repository>
        <id>maven-restlet</id>
        <name>Public online Restlet repository</name>
        <url>http://maven.restlet.org</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>${camel-version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring</artifactId>
        <version>${camel-version}</version>
    </dependency>        
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-expression</artifactId>
        <version>3.2.4.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-restlet</artifactId>
        <version>${camel-version}</version>
    </dependency>
    <dependency>
        <groupId>org.restlet.jee</groupId>
        <artifactId>org.restlet.ext.spring</artifactId>
        <version>${restlet-version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derby</artifactId>
        <version>10.9.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.5</version>
    </dependency>
</dependencies>

如果需要,添加其他依赖项。可以使用mvn dependency:tree来测试依赖关系树。