복붙노트

[SPRING] MVC 템플릿 프로젝트의 pom.xml 오류

SPRING

MVC 템플릿 프로젝트의 pom.xml 오류

나는 STS를 사용하고 Spring MVC Template Project를 만들었다. 그러나 pom.xml은 오류가 있다는 것을 알려주며 다음과 같이 씁니다 :

"No plugin found for prefix 'war' in the current project and in the plugin groups [] available from the repositories [local (C:\Users\m1e\.m2\repository), central (http://repo.maven.apache.org/maven2)]"

나는 STS와 Maven을 처음으로 사용하고 있으며 나는 멍청이다. 나는 그것이 무엇을 의미하는지 정말로 이해하지 못한다. 얘들 아, 도와주세요. 감사!

다음은 내 pom.xml입니다.

<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.andrew</groupId>
    <artifactId>mvc</artifactId>
    <name>NewMVC</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <properties>
        <java-version>1.6</java-version>
        <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.slf4j-version>1.6.6</org.slf4j-version>
    </properties>
    <dependencies>
        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                 </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- AspectJ -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${org.aspectj-version}</version>
        </dependency>   


                <!-- Database -->
        <dependency>
            <groupId>mssql</groupId>
            <artifactId>sqljdbc</artifactId>
            <version>4.0</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

        <!-- @Inject -->

        <!-- Servlet -->
<!--        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency> -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>

        <!-- Hibernate -->
        <dependency>
            <groupId>hibernate</groupId>
            <artifactId>hibernate-commons-annotations</artifactId>
            <version>1.0</version>
        </dependency>
        <!-- Hibernate -->
        <dependency>
            <groupId>hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>hibernate</groupId>
            <artifactId>hibernate</artifactId>
            <version>3.0</version>
        </dependency>
        <dependency>
            <groupId>persistence</groupId>
            <artifactId>persistence</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>


</project>

해결법

  1. ==============================

    1.mmm 내가 제일 먼저 확인해야 할 것은 Maven 버전이다.

    mmm 내가 제일 먼저 확인해야 할 것은 Maven 버전이다.

    어떤 STS 버전을 사용하고 있습니까? 마지막 버전은 3.1.0이며 Maven 3.0.4 버전과 함께 제공됩니다.

    그렇다면 왜 Maven 2 이전 버전을 사용하고 있습니까?

    문제는 특정 Maven 플러그인이 없다는 것에 달려있는 것처럼 보입니다.

    하려고 노력하다:

    1) ./m2 디렉토리 내의 저장소 폴더를 삭제 한 다음 STS로 이동하여 프로젝트의 클린 또는 메이븐 설치를 수행하고 작동하는지 확인합니다 (때로는 다운로드하는 것이 잘못되었다고 생각합니다)

    마지막 Maven 버전을 사용하지 않는다면, 이전 버전은 스프링 템플릿 프로젝트의 pom.xml 파일에 선언 된 플러그인에 문제가있을 수 있습니다 ... STORY의 최신 버전을 다운로드하면 또한 최신 버전의 Maven!

  2. from https://stackoverflow.com/questions/13788190/error-with-pom-xml-in-mvc-template-project by cc-by-sa and MIT license