自定义处理器构建由于杰克逊依赖性而导致的失败



我已经创建了一个使用Jackson JSON库的自定义处理器,并且单位检验正常。

我对要构建哪个项目/模块来创建目标NAR有点困惑。

处理器(maven)项目的pom.xml是:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
license agreements. See the NOTICE file distributed with this work for additional 
information regarding copyright ownership. The ASF licenses this file to 
You under the Apache License, Version 2.0 (the "License"); you may not use 
this file except in compliance with the License. You may obtain a copy of 
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
by applicable law or agreed to in writing, software distributed under the 
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
OF ANY KIND, either express or implied. See the License for the specific 
language governing permissions and limitations under the License. -->
<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.datalake</groupId>
<artifactId>CDCNiFi</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>nifi-NiFiCDCPoC-processors</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-utils</artifactId>
</dependency>
<dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
        </dependency>        
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-mock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-dbcp-service-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

nar(maven)项目的pom.xml是:

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements. See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<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.datalake</groupId>
        <artifactId>CDCNiFi</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>nifi-NiFiCDCPoC-nar</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>nar</packaging>
    <properties>
        <maven.javadoc.skip>true</maven.javadoc.skip>
        <source.skip>true</source.skip>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.datalake</groupId>
            <artifactId>nifi-NiFiCDCPoC-processors</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>

父(?)pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements. See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<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>org.apache.nifi</groupId>
        <artifactId>nifi-nar-bundles</artifactId>
        <version>1.1.1</version>
    </parent>
    <groupId>com.datalake</groupId>
    <artifactId>CDCNiFi</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <modules>
        <module>nifi-NiFiCDCPoC-processors</module>
        <module>nifi-NiFiCDCPoC-nar</module>
    </modules>
</project>

现在,当我尝试构建父母或处理器项目时,我会遇到杰克逊错误,我无法理解为什么杰克逊库没有加载:

E:NiFiCDCNiFinifi-NiFiCDCPoC-proces
sors>mvn clean install
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO]   ... total of 1 executions of maven-deploy-plugin replaced with nexus-st
aging-maven-plugin
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building nifi-NiFiCDCPoC-processors 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ nifi-NiFiCDCPoC-proces
sors ---
[INFO] Deleting E:NiFiCDCNiFinifi-N
iFiCDCPoC-processorstarget
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven) @ nifi-NiFiCDCPoC
-processors ---
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (default) @ nifi-NiFiCDCPoC
-processors ---
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ nifi-NiFiC
DCPoC-processors ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ nifi-NiFiCDCPoC
-processors ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to E:
NiFiCDCNiFinifi-NiFiCDCPoC-processorstargetclasses
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] E:NiFiCDCNiFinifi-NiFiCDCPo
C-processorssrcmainjavacomdatalakeprocessorsMyProcessor.java:[65,3
3] error: package com.fasterxml.jackson.core does not exist
[ERROR] E:NiFiCDCNiFinifi-NiFiCDCPo
C-processorssrcmainjavacomdatalakeprocessorsMyProcessor.java:[66,3
7] error: package com.fasterxml.jackson.databind does not exist
[ERROR] E:NiFiCDCNiFinifi-NiFiCDCPo
C-processorssrcmainjavacomdatalakeprocessorsMyProcessor.java:[250,
10] error: cannot find symbol
[ERROR]   symbol:   class ObjectMapper
  location: class MyProcessor
E:NiFiCDCNiFinifi-NiFiCDCPoC-proces
sorssrcmainjavacomdatalakeprocessorsMyProcessor.java:[250,42] erro
r: cannot find symbol
[ERROR]   symbol:   class ObjectMapper
  location: class MyProcessor
E:NiFiCDCNiFinifi-NiFiCDCPoC-proces
sorssrcmainjavacomdatalakeprocessorsMyProcessor.java:[279,21] erro
r: cannot find symbol
[INFO] 5 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.179 s
[INFO] Finished at: 2017-03-06T21:26:33+01:00
[INFO] Final Memory: 27M/560M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
2:compile (default-compile) on project nifi-NiFiCDCPoC-processors: Compilation f
ailure: Compilation failure:
[ERROR] E:NiFiCDCNiFinifi-NiFiCDCPo
C-processorssrcmainjavacomdatalakeprocessorsMyProcessor.java:[65,3
3] error: package com.fasterxml.jackson.core does not exist
[ERROR] E:NiFiCDCNiFinifi-NiFiCDCPo
C-processorssrcmainjavacomdatalakeprocessorsMyProcessor.java:[66,3
7] error: package com.fasterxml.jackson.databind does not exist
[ERROR] E:NiFiCDCNiFinifi-NiFiCDCPo
C-processorssrcmainjavacomdatalakeprocessorsMyProcessor.java:[250,
10] error: cannot find symbol
[ERROR] symbol:   class ObjectMapper
[ERROR] location: class MyProcessor
[ERROR] E:NiFiCDCNiFinifi-NiFiCDCPo
C-processorssrcmainjavacomdatalakeprocessorsMyProcessor.java:[250,
42] error: cannot find symbol
[ERROR] symbol:   class ObjectMapper
[ERROR] location: class MyProcessor
[ERROR] E:NiFiCDCNiFinifi-NiFiCDCPo
C-processorssrcmainjavacomdatalakeprocessorsMyProcessor.java:[279,
21] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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/MojoFailureException

您必须在处理器(maven)project pom.xml中添加以下依赖项为:。

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.7.8</version>
</dependency>

最新更新