简体   繁体   English

为什么添加Spring依赖项时Maven插件为何显示错误

[英]Why does maven plugins show error when spring dependency is added

I was trying to create a maven project and add spring boot dependencies later, but i kept getting error highlights on maven plugins. 我试图创建一个Maven项目并在以后添加spring boot依赖项,但是我一直在maven插件上看到错误提示。 Here below is the screenshot: Maven Projects screenshot from intellij 以下是屏幕截图: intellij的Maven Projects屏幕截图

And my POM file contents: 和我的POM文件内容:

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0

<groupId>org.springframework</groupId>
<artifactId>gs-producing-web-service</artifactId>
<version>0.1.0</version>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.10.RELEASE</version>
</parent>

<properties>
    <java.version>1.8</java.version>
</properties>
<repositories>
    <repository>
        <id>java.net</id>
        <url>http://repo.maven.apache.org/maven2/</url>
    </repository>
</repositories>
<dependencies>
    <!-- tag::springws[] -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web-services</artifactId>
    </dependency>
    <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
    </dependency>
    <!-- end::springws[] -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>

        <!-- tag::xsd[] -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <id>xjc</id>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory>
                <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
                <clearOutputDir>false</clearOutputDir>
            </configuration>
        </plugin>
        <!-- end::xsd[] -->
    </plugins>
</build>

May be you have just added the dependencies in your pom.xml file but they are not in your local maven repository. 可能是您刚刚在pom.xml文件中添加了依赖项,但它们不在本地maven存储库中。 For this purpose you have build/rebuild the project. 为此,您具有构建/重建项目。 Once you successfully build the project those dependencies will add to your local repository and will not show these error. 成功构建项目后,这些依赖项将添加到本地存储库中,并且不会显示这些错误。

Have you built successfully already? 您已经成功建立了吗? If still there are errors, then might be other issue. 如果仍然有错误,则可能是其他问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM