Maven은 컴파일 오류를 반환 패키지 com.mashape.unirest.http이 존재하지 않습니다

IceRevenge :

나는 종속성 Unirest를 설치하는 메이븐을 사용하려고했습니다. 나는 .jar 파일 (다운로드 unirest - 자바-1.4.9.jar을 )이 같은 POM에 추가 :

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.mashape.unirest</groupId>
            <artifactId>unirest-java</artifactId>
            <version>1.4.9</version>
        </dependency>
    </dependencies>
</dependencyManagement>

또한, 나는 이클립스에 .JAR을 추가 : 식

이제 Maven은 패키지가 존재하지 않는 것을 말한다. Eclipse는 일이 잘못이라고 말하지 않았다. 내가 무슨 일을 했는가? 문제부터의 경고가 있습니까?

내 로그 :

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.sap.cloud.sdk.sensorLive:sensorLive-application:war:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ com.sap.cloud.sdk.sensorLive:sensorLive:1.0-SNAPSHOT, C:\Users\c5283284\Documents\Projekte\Transformation module\sensorLive\pom.xml, line 52, column 21
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.sap.cloud.sdk.sensorLive:sensorLive-unit-tests:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ com.sap.cloud.sdk.sensorLive:sensorLive:1.0-SNAPSHOT, C:\Users\c5283284\Documents\Projekte\Transformation module\sensorLive\pom.xml, line 52, column 21
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.sap.cloud.sdk.sensorLive:sensorLive-integration-tests:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ com.sap.cloud.sdk.sensorLive:sensorLive:1.0-SNAPSHOT, C:\Users\c5283284\Documents\Projekte\Transformation module\sensorLive\pom.xml, line 52, column 21
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.sap.cloud.sdk.sensorLive:sensorLive:pom:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 52, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] sensorLive - Root                                                  [pom]
[INFO] sensorLive - Application                                           [war]
[INFO] sensorLive - Unit Tests                                            [jar]
[INFO] sensorLive - Integration Tests                                     [jar]
[INFO]
[INFO] --------------< com.sap.cloud.sdk.sensorLive:sensorLive >---------------
[INFO] Building sensorLive - Root 1.0-SNAPSHOT                            [1/4]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (SAP S/4HANA Cloud SDK Project Structure Checks) @ sensorLive ---
[INFO]
[INFO] --------< com.sap.cloud.sdk.sensorLive:sensorLive-application >---------
[INFO] Building sensorLive - Application 1.0-SNAPSHOT                     [2/4]
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (SAP S/4HANA Cloud SDK Project Structure Checks) @ sensorLive-application ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ sensorLive-application ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ sensorLive-application ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 9 source files to C:\Users\c5283284\Documents\Projekte\Transformation module\sensorLive\application\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/c5283284/Documents/Projekte/Transformation module/sensorLive/application/src/main/java/com/sap/cloud/sdk/sensorLive/Servlet.java:[16,1] package com.mashape.unirest.http does not exist
[ERROR] /C:/Users/c5283284/Documents/Projekte/Transformation module/sensorLive/application/src/main/java/com/sap/cloud/sdk/sensorLive/Servlet.java:[17,32] package com.mashape.unirest.http does not exist
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for sensorLive - Root 1.0-SNAPSHOT:
[INFO]
[INFO] sensorLive - Root .................................. SUCCESS [  0.485 s]
[INFO] sensorLive - Application ........................... FAILURE [  2.233 s]
[INFO] sensorLive - Unit Tests ............................ SKIPPED
[INFO] sensorLive - Integration Tests ..................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.079 s
[INFO] Finished at: 2019-01-31T10:22:32+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project sensorLive-application: Compilation failure: Compilation failure:
[ERROR] /C:/Users/c5283284/Documents/Projekte/Transformation module/sensorLive/application/src/main/java/com/sap/cloud/sdk/sensorLive/Servlet.java:[16,1] package com.mashape.unirest.http does not exist
[ERROR] /C:/Users/c5283284/Documents/Projekte/Transformation module/sensorLive/application/src/main/java/com/sap/cloud/sdk/sensorLive/Servlet.java:[17,32] package com.mashape.unirest.http does not exist
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :sensorLive-application

내 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/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <name>sensorLive - Root</name>
    <description>sensorLive - Root</description>

    <groupId>com.sap.cloud.sdk.sensorLive</groupId>
    <artifactId>sensorLive</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.sap.cloud.s4hana</groupId>
                <artifactId>sdk-bom</artifactId>
                <version>2.9.1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.mashape.unirest</groupId>
                <artifactId>unirest-java</artifactId>
                <version>1.4.9</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <properties>
        <java.version>1.8</java.version>

        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.testSource>${java.version}</maven.compiler.testSource>
        <maven.compiler.testTarget>${java.version}</maven.compiler.testTarget>

        <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <modules>
        <module>application</module>
        <module>unit-tests</module>
        <module>integration-tests</module>
    </modules>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.maventest.App</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.openejb.maven</groupId>
                <artifactId>tomee-maven-plugin</artifactId>
                <version>1.7.1</version>
                <configuration>
                    <tomeeVersion>1.7.1</tomeeVersion>
                    <tomeeClassifier>plus</tomeeClassifier>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M2</version>
                <executions>
                    <execution>
                        <id>SAP S/4HANA Cloud SDK Project Structure Checks</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.3.9</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>${java.version}</version>
                                </requireJavaVersion>
                                <reactorModuleConvergence />
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

이것은 내가 Unirest을 가져 오는 방법은 다음과 같습니다

import com.mashape.unirest.http.*;
Watbub :

당신은 당신의 의존성을 추가 dependencyManagement하여 치어의 섹션을 참조하십시오. 이 섹션은 의존성 부모 POM 정의되지만 하위 모듈에 사용될 수있는 다중 모듈 프로젝트를 위해 의도된다. 추가 읽기 .

(이 경우의 치어를, 자녀 모듈의 치어를 열어야합니다 귀하의 의존성을 사용할 수 있도록 application, unit-tests또는 integration-tests) 당신이 그렇게이 좋아하는 종속성을 사용하고자하는 것을 받는다는 이야기 :

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

    ...

    <groupId>com.sap.cloud.sdk.sensorLive</groupId>
    <artifactId>application</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>com.mashape.unirest</groupId>
            <artifactId>unirest-java</artifactId>
        </dependency>
    </dependencies>

    ...

</project>

추천

출처http://43.154.161.224:23101/article/api/json?id=202764&siteId=1