Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
893 views
in Technique[技术] by (71.8m points)

yaml - Deploy Non-Jar POM-Only Artifacts With Maven Release Plugin in Bitbucket Pipeline

I have a series of OpenAPI 3 Documents (yaml files) for which I want to automate deployment and versioning using the Maven Release Plugin in a Bitbucket Pipeline. Here is the step script in our pipeline which gets run when we merge to the master branch (this is a script we use in all of our Java projects and we know works correctly there):

    - step: &deployRelease
        name: Depoly Release Versions
        trigger: manual
        script: 
          - bash scripts/create-settings.sh
          - bash scripts/validate-release-config.sh
          - mvn -B -s settings.xml deploy
          - git config --global user.email "$GIT_USER_EMAIL"
          - git config --global user.name "$GIT_USER_NAME"
          - mvn -B -DdryRun=true release:prepare
          - mvn -B release:clean release:prepare

We use the build-helper-maven-plugin to attach our artifact to the build, then use maven-antrun-plugin to rename the file. The rest of our plugin configuration in the POM file is as follows:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <tagNameFormat>v@{project.version}</tagNameFormat>
          <autoVersionSubmodules>true</autoVersionSubmodules>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.5.2</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.8.2</version>
        <configuration>
          <file>${project.build.directory}/dictionary-${project.version}.yaml</file>
        </configuration>
      </plugin>

When the pipeline is run, the SNAPSHOT version is deployed to the NEXUS Snapshots repository correctly, and the pipeline finishes successfully, even updating the version in the pom files as expected, but none of the artifacts are deployed to the NEXUS Releases repository as expected. I'm sure it's just a step I'm missing somewhere (I'm admittedly not very strong with maven tools). Any ideas how to get the yaml files to deploy to Releases? Let me know if you need more information.

question from:https://stackoverflow.com/questions/65891119/deploy-non-jar-pom-only-artifacts-with-maven-release-plugin-in-bitbucket-pipelin

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...