1
我創建了一個使用jackson json庫並且單元測試正常工作的自定義處理器。由於傑克遜依賴關係,自定義處理器構建失敗
我有點困惑要建立哪個項目/模塊來創建目標nar。
所述處理器(行家)項目的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(行家)項目的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:\NiFi\CDCNiFi\nifi-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:\NiFi\CDCNiFi\nifi-N
iFiCDCPoC-processors\target
[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:\
NiFi\CDCNiFi\nifi-NiFiCDCPoC-processors\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] E:\NiFi\CDCNiFi\nifi-NiFiCDCPo
C-processors\src\main\java\com\datalake\processors\MyProcessor.java:[65,3
3] error: package com.fasterxml.jackson.core does not exist
[ERROR] E:\NiFi\CDCNiFi\nifi-NiFiCDCPo
C-processors\src\main\java\com\datalake\processors\MyProcessor.java:[66,3
7] error: package com.fasterxml.jackson.databind does not exist
[ERROR] E:\NiFi\CDCNiFi\nifi-NiFiCDCPo
C-processors\src\main\java\com\datalake\processors\MyProcessor.java:[250,
10] error: cannot find symbol
[ERROR] symbol: class ObjectMapper
location: class MyProcessor
E:\NiFi\CDCNiFi\nifi-NiFiCDCPoC-proces
sors\src\main\java\com\datalake\processors\MyProcessor.java:[250,42] erro
r: cannot find symbol
[ERROR] symbol: class ObjectMapper
location: class MyProcessor
E:\NiFi\CDCNiFi\nifi-NiFiCDCPoC-proces
sors\src\main\java\com\datalake\processors\MyProcessor.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:\NiFi\CDCNiFi\nifi-NiFiCDCPo
C-processors\src\main\java\com\datalake\processors\MyProcessor.java:[65,3
3] error: package com.fasterxml.jackson.core does not exist
[ERROR] E:\NiFi\CDCNiFi\nifi-NiFiCDCPo
C-processors\src\main\java\com\datalake\processors\MyProcessor.java:[66,3
7] error: package com.fasterxml.jackson.databind does not exist
[ERROR] E:\NiFi\CDCNiFi\nifi-NiFiCDCPo
C-processors\src\main\java\com\datalake\processors\MyProcessor.java:[250,
10] error: cannot find symbol
[ERROR] symbol: class ObjectMapper
[ERROR] location: class MyProcessor
[ERROR] E:\NiFi\CDCNiFi\nifi-NiFiCDCPo
C-processors\src\main\java\com\datalake\processors\MyProcessor.java:[250,
42] error: cannot find symbol
[ERROR] symbol: class ObjectMapper
[ERROR] location: class MyProcessor
[ERROR] E:\NiFi\CDCNiFi\nifi-NiFiCDCPo
C-processors\src\main\java\com\datalake\processors\MyProcessor.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
有點奇怪 - 在Eclipse中,編譯和單元測試工作沒有補充說,我只是有以下幾點: \t \t \t org.codehaus.jackson \t \t \t 傑克遜映射器-asl \t \t \t \t –