Spring Camel:进程以退出代码0结束

时间:2017-12-15 01:01:13

标签: spring maven tomcat apache-camel

我正在尝试将camel集成到现有的spring项目中,该项目使用嵌入式tomcat实例在本地运行。 spring项目在我添加任何camel依赖项之前工作,但是,在添加了4个camel依赖项后,我收到消息" Process with exit code 0"。我正在使用maven构建应用程序并在嵌入式tomcat实例中运行它(mvn clean install -Pembedded(参见下面的配置文件))。

我不是Camel新手,但我仍然无法弄清楚下面的依赖关系如何导致我的spring进程完成运行(看起来spring在添加camel依赖项后没有看到任何执行)。如何保持现有的spring应用程序工作并仍然具有新的camel依赖项?

以下是新的依赖项:

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>${org.apache.camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-aws</artifactId>
        <version>2.19.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-test</artifactId>
        <version>${org.apache.camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-http4</artifactId>
        <version>${org.apache.camel.version}</version>
    </dependency>

这是完整的文件(删除了私人信息):

<?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">
<modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>com.----.----</groupId>
    <artifactId>webs-parent</artifactId>
    <version>1.0.6-SNAPSHOT</version>
</parent>

<artifactId>webs-catalog</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>${packaging.type}</packaging>

<name>catalog-service</name>
<description>Commerce Catalog Service</description>
<url>----</url>

<properties>
    <jacoco.minimum.code.coverage>0.8</jacoco.minimum.code.coverage>
    <packaging.type>war</packaging.type>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <central.repo>----</central.repo> <!-- "nexus-proxy" is a cache -->
    <org.apache.camel.version>2.16.0</org.apache.camel.version>
</properties>

<dependencies>
    <dependency>
        <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-csv</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>${org.apache.camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-aws</artifactId>
        <version>2.19.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-test</artifactId>
        <version>${org.apache.camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-http4</artifactId>
        <version>${org.apache.camel.version}</version>
    </dependency>
</dependencies>



<profiles>
    <!-- Default build profile for generating war -->
    <profile>
        <id>war</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <packaging.type>war</packaging.type>
            <log.dir>${catalina.base}/logs</log.dir>
            <!-- updates bootstrap.properties -->
            <config.override.path>file:${catalina.base}/conf</config.override.path>
        </properties>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
                <scope>provided</scope>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <descriptor>/src/main/resources/deployablecontent.xml</descriptor>
                        <tarLongFileMode>posix</tarLongFileMode>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

            </plugins>
        </build>
    </profile>

    <!-- Build profile for stand-alone java application with embedded Tomcat 
        Container -->
    <profile>
        <id>embedded</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <properties>
            <packaging.type>jar</packaging.type>
            <log.dir>logs</log.dir>
            <!-- updates bootstrap.properties -->
            <config.override.path>./conf</config.override.path> 
        </properties>
    </profile>
</profiles>

<repositories>
    <repository>
        <id>central-mirror</id>
        <url>${central.repo}</url>
    </repository>
</repositories>

1 个答案:

答案 0 :(得分:1)

删除 spring-boot-starter-tomcat 提供的范围,然后它成为默认范围编译。在嵌入式tomcat环境中,您应该设置默认范围编译以及是否要将war部署到任何其他独立tomcat。可以将此依赖关系标记为已提供。