Почему я не могу импортировать класс в свой файл Java в моем проекте Eclipse Maven? - PullRequest
0 голосов
/ 15 июня 2019

Я нашел следующее в Maven Repository :

<!-- https://mvnrepository.com/artifact/org.springframework.xd/spring-xd-dirt -->
<dependency>
    <groupId>org.springframework.xd</groupId>
    <artifactId>spring-xd-dirt</artifactId>
    <version>1.0.4.RELEASE</version>
</dependency>

Домашняя страница, предоставленная репозиторием Maven, приводит меня к этому java-файлу .

Вот оно:

/*
 * Copyright 2015 the original author or authors.
 *
 * Licensed 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.
 */

package org.springframework.xd.dirt.web.controller.support;

/**
 *
 * @author Gunnar Hillert
 *
 */
public class AuthenticationRequest {

    private String username;

    private String password;

    public AuthenticationRequest() {
    }

    public AuthenticationRequest(String username, String password) {
        this.username = username;
        this.password = password;
    }

    /**
     * @return the username
     */
    public String getUsername() {
        return username;
    }

    /**
     * @param username the username to set
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "AuthenticationRequest [username=" + username + ", password=" + password + "]";
    }


}

Эта страница сообщает мне, что запрос AuthenticationRequest можно импортировать с помощью

import org.springframework.xd.dirt.web.controller.support.AuthenticationRequest;

Я получаю сообщение об ошибке в файле pom.xml о том, что отсутствует артефакт. Я полагаю, что библиотека зависит от другой библиотеки. Я поместил артефакт в файл pom.xml, и эта ошибка устранена.

Но я все еще получаю сообщение об ошибке, в котором говорится об операторе импорта:

Импорт org.springframework.xd.dirt.web.controller.support не может быть решен

Что мне не хватает? Как импортировать класс AuthenticationRequest?

1 Ответ

0 голосов
/ 15 июня 2019

Я провел поиск и понял, что мне нужно включить в свой файл pom.xml следующее:

    <dependency>
        <groupId>org.springframework.xd</groupId>
        <artifactId>spring-xd-dirt</artifactId>
        <!-- <version>1.0.4.RELEASE</version> -->
        <version>1.3.1.RELEASE</version>
        <!-- <scope>compile</scope> -->
    </dependency>

    <repository>
        <id>spring-repo</id>
        <url>https://repo.spring.io/release</url>
    </repository>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...