“未知生命周期阶段""MVN".您必须指定一个有效的生命周期阶段或目标“使用Azure部署应用程序时 [英] "Unknown lifecycle phase "mvn". You must specify a valid lifecycle phase or a goal" While Deploying the application using Azure

查看:117
本文介绍了“未知生命周期阶段""MVN".您必须指定一个有效的生命周期阶段或目标“使用Azure部署应用程序时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Azure Devops在云中心上部署一个ule子应用程序.在尝试部署应用程序时,我正在运行一个作业,该作业具有一个假定要运行maven命令的Maven任务:

I am trying to deploy a mule application on cloud hub using Azure Devops. While trying to deploy the application I am running a job which have a task Maven that is suppose to run a maven command:

mvn包部署-DmuleDeploy -Dcloud.env =沙箱-Danypoint.businessGroup = TestBusiness -Dcloudhub.workerType = Small -DcloudhubAppName = testdeployment -Dmule.version = 4.2.2 -Dcloud.user = UserUser -Dcloud.password = ***

mvn package deploy -DmuleDeploy -Dcloud.env=Sandbox -Danypoint.businessGroup=TestBusiness -Dcloudhub.workerType=Small -DcloudhubAppName=testdeployment -Dmule.version=4.2.2 -Dcloud.user=UserUser -Dcloud.password=***

那应该使用云中心上的pom.xml文件部署构建但我收到此错误:

That should deploy the build using the pom.xml file on cloud hub But I am getting this error:

未知生命周期阶段"mvn".您必须以格式指定有效的生命周期阶段或目标< plugin-prefix>:< goal>或< plugin-group-id>:< plugin-artifact-id> [:< plugin-version>]:< goal>

Unknown lifecycle phase "mvn". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>

下面是我的pom.xml文件`4.0.0

Below is my pom.xml file ` 4.0.0

<groupId>com.mycompany</groupId>
<artifactId>testdeployment</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>

<name>testdeployment</name>

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

    <app.runtime>4.2.2</app.runtime>
    <mule.maven.plugin.version>3.3.5</mule.maven.plugin.version>
</properties>

<build>
<defaultGoal>mvn deploy</defaultGoal>
    <plugins>
        <plugin>
            <groupId>org.mule.tools.maven</groupId>
            <artifactId>mule-maven-plugin</artifactId>
            <version>${mule.maven.plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
                <cloudHubDeployment>
                <uri>https://anypoint.mulesoft.com</uri>
                <muleVersion>${app.runtime}</muleVersion>
                <username>${anypoint.username}</username>
                <password>${anypoint.password}</password>
                <businessGroup>${businessGroup}</businessGroup>
                <workers>${workers}</workers>
                <workerType>${workerType}</workerType>
                <region>us-west-1</region>
                <environment>${environment}</environment>
                <applicationName>${applicationName}</applicationName>
                <properties>
                    <mule.env>${mule.env}</mule.env>
                    <encrypt.key>${encrypt.key}</encrypt.key>                   
                    <anypoint.platform.client_id>${anypoint.platform.client_id}     
                    </anypoint.platform.client_id>      
                    <anypoint.platform.client_secret>${anypoint.platform.client_secret}</anypoint.platform.client_secret>
                    <api.id>${ilg.api.version}</api.id>
                    <anypoint.platform.config.analytics.agent.enabled>true</anypoint.platform.config.analytics.agent.enabled>
                </properties>
                </cloudHubDeployment>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.mule.connectors</groupId>
        <artifactId>mule-http-connector</artifactId>
        <version>1.5.11</version>
        <classifier>mule-plugin</classifier>
    </dependency>
    <dependency>
        <groupId>org.mule.connectors</groupId>
        <artifactId>mule-sockets-connector</artifactId>
        <version>1.1.5</version>
        <classifier>mule-plugin</classifier>
    </dependency>
</dependencies>

<repositories>
      <repository>
        <id>anypoint-exchange-v2</id>
        <name>Anypoint Exchange</name>
        <url>https://maven.anypoint.mulesoft.com/api/v2/maven</url>
        <layout>default</layout>
    </repository>
    <repository>
        <id>mulesoft-releases</id>
        <name>MuleSoft Releases Repository</name>
        <url>https://repository.mulesoft.org/releases/</url>
        <layout>default</layout>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>mulesoft-releases</id>
        <name>mulesoft release repository</name>
        <layout>default</layout>
        <url>https://repository.mulesoft.org/releases/</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

`

推荐答案

该错误是因为您将 mvn 命令放在< defaultGoal> 元素内. mvn 是执行Maven的命令行.在pom中没有任何意义.删除它并留下真正的Maven目标,例如 deploy .

The error is because you put the mvn command inside the <defaultGoal> element. mvn is the command line to execute Maven. It has no meaning inside a pom. Remove it and leave a real Maven goal, like deploy.

示例:

<defaultGoal>deploy</defaultGoal>

请注意,除了CloudHub部署外,使用 deploy 还将尝试执行Maven部署. mule:deploy 可能仅对部署到CloudHub有用.

Note that using deploy will also try to execute Maven deployments in addition to CloudHub deployments. mule:deploy might be more useful just to deploy to CloudHub.

这篇关于“未知生命周期阶段""MVN".您必须指定一个有效的生命周期阶段或目标“使用Azure部署应用程序时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆