2017-03-07 13 views
1

jackson jsonライブラリを使用したカスタムプロセッサを作成し、ユニットテストがうまく動作しました。ジャック依存のためにカスタムプロセッサビルドが失敗する

ターゲットnarを作成するために構築するプロジェクト/モジュールについて少し混乱します。

プロセッサののpom.xml(Mavenの)プロジェクトは次のとおりです。

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

親ポンポン.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 

答えて

1

はあなたがあなたのプロセッサ(Mavenの)プロジェクトpom.xmlに以下の依存関係を追加する必要があります:

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

少し奇妙 - Eclipseで、コンパイルやユニットテストは、私は次のように持っていた、と付け加えずに働いた: \t \t \t org.codehaus.jackson \t \t \t ジャクソンマッパー-asl \t \t \t \t

関連する問題