Home > Mobile >  No transfer protocol found while deploying an artifact using maven deploy in Azure DevOps
No transfer protocol found while deploying an artifact using maven deploy in Azure DevOps

Time:10-03

When I am trying to deploy a JAR artifact to artifact feed in Azure DevOPS facing the below issue.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (default-cli) on project: No transfer protocol found. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Below is my YAML code:

- task: Maven@3
  displayName: 'Maven Deploy'
  inputs:
   mavenPomFile: 'pom.xml'
   goals: 'deploy:deploy-file'
   options: '-DgroupId="com.mycompany" -DartifactId="s-demo-cicd" -Dversion="1.0.1" - 
       Dpackaging=jar -Dfile="demo-1.0.1-mule-application.jar" -DgeneratePom="true" - 
       DrepositoryId="$AZURE_FEED_ID" -Durl="$AZURE_FEED_URL"'

I have added required dependencies in POM.xml file.

    <distributionManagement>
        <repository>
            <id>demo-mule</id>
            <url>https://pkgs.dev.azure.com/demo-mule/_packaging/demo-mule/maven/v1</url>
         <releases>
           <enabled>true</enabled>
         </releases>
         <snapshots>
           <enabled>true</enabled>
         </snapshots>
       </repository>
    </distributionManagement>

Please help me understand where I need to make the changes or updates.

CodePudding user response:

To pass a variable into the parameters of the Maven task, make sure you use the correct notation. It can be a bit confusing at times.

In this case use $(...) instead of $.... So your task would look like this:

- task: Maven@3
  displayName: 'Maven Deploy'
  inputs:
   mavenPomFile: 'pom.xml'
   goals: 'deploy:deploy-file'
   options: '-DgroupId="com.mycompany" -DartifactId="s-demo-cicd" -Dversion="1.0.1" - 
       Dpackaging=jar -Dfile="demo-1.0.1-mule-application.jar" -DgeneratePom="true" - 
       DrepositoryId="$(AZURE_FEED_ID)" -Durl="$(AZURE_FEED_URL)"'
  • Related