如何在pom文件中配置maven

时间:2016-04-14 10:19:54

标签: apache maven intellij-idea pom.xml

我使用intellij创建maven项目.intellij包含maven插件apache-maven-3.3.9。当我部署项目时,我收到以下错误。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project MyProject: Failed to deploy artifacts/metadata: Cannot access scp://repo/maven2 with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access scp://repo/maven2 using the registered transporter factories: WagonTransporterFactory: java.util.NoSuchElementException
[ERROR] role: org.apache.maven.wagon.Wagon
[ERROR] roleHint: scp

下面是我的pom文件。

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

<groupId>MyProject</groupId>
<artifactId>MyProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
    <spring.version>4.2.5.RELEASE</spring.version>
    <hibernate.version>4.2.2.Final</hibernate.version>
</properties>

<distributionManagement>
    <repository>
        <uniqueVersion>false</uniqueVersion>
        <id>corp1</id>
        <name>Corporate Repository</name>
        <url>scp://repo/maven2</url>
        <layout>default</layout>
    </repository>

</distributionManagement>

<dependencies>
 ...
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>
 </project>

我不知道我在这里做错了什么。请帮助我。

1 个答案:

答案 0 :(得分:1)

示例中的部署是指将项目artefact(war文件)部署到组织中的某个Maven存储库中。

将应用程序部署到应用程序容器(如Tomcat)最好使用tomcat-maven-plugin等插件完成,请参阅Hohenheim提到的教程。