Maven基础

来自linux中国网wiki
Evan讨论 | 贡献2024年10月2日 (三) 08:21的版本 →‎Spring Boot Maven 打包可执行Jar文件
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航 跳到搜索

Spring Boot Maven 打包可执行Jar文件

mvn clean package

trouble

SNAPSHOT does not alalow version

version policy  默认release 改为 mixed 

PushArtifact
[Pipeline] nexusArtifactUploader
Uploading artifact demo-0.0.1-SNAPSHOT.jar started....
GroupId: com.devops6
ArtifactId: demo
Classifier: 
Type: jar
Version: 0.0.1
File: demo-0.0.1-SNAPSHOT.jar
Repository:maven-devops6-release
Uploading: http://192.168.10.105:8081/repository/maven-devops6-release/com/devops6/demo/0.0.1/demo-0.0.1.jar
Failed to deploy artifacts: Could not transfer artifact com.devops6:demo:jar:0.0.1 from/to maven-devops6-release (http://192.168.10.105:8081/repository/maven-devops6-release): transfer failed for http://192.168.10.105:8081/repository/maven-devops6-release/com/devops6/demo/0.0.1/demo-0.0.1.jar, status: 400 Repository version policy: SNAPSHOT does not allow version: 0.0.1

pipeline 

       stage('PushArtifact'){
            steps {
                script{
                    println("PushArtifact")
                    PushArtifactByPlugin()
                }
            }

        }


    }
}



def PushArtifactByPlugin(){
    nexusArtifactUploader artifacts: [[artifactId: 'demo', classifier: '', file: 'target/demo-0.0.1-SNAPSHOT.jar',  type: 'jar']], credentialsId: 'f26c7693-66d8-41d9-8ad4-bfb20eaa4634', groupId: 'com.devops6',  nexusUrl: '192.168.10.105:8081', nexusVersion: 'nexus3', protocol: 'http',  repository: 'maven-devops6-release',version: '0.0.1'


    //nexusArtifactUploader credentialsId: 'f26c7693-66d8-41d9-8ad4-bfb20eaa4634', groupId: 'com.devops6', nexusUrl: '192.168.10.105:8081', nexusVersion: 'nexus2', protocol: 'http', repository: 'maven-devops6-release', version: 'nexus3'





}

https://community.sonatype.com/t/400-repository-version-policy-snapshot-does-not-allow-version-3-0-0/4053

Installing Apache Maven

refences

Maven 教程

Spring Boot Maven 打包可执行Jar文件!

Spring入门(四):使用Maven管理Spring项目

Maven仓库安装配置及使用