“Maven基础”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
 
(未显示同一用户的1个中间版本)
第2行: 第2行:
  
  
[[Installing Apache Maven]]
+
 
 +
 
 +
 
 +
 
  
 
  mvn clean package
 
  mvn clean package
 +
 +
=trouble=
 +
==SNAPSHOT does not alalow version  ==
 +
<pre>
 +
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'
 +
 +
 +
 +
 +
 +
}
 +
 +
</pre>
 +
https://community.sonatype.com/t/400-repository-version-policy-snapshot-does-not-allow-version-3-0-0/4053
 +
 +
[[Installing Apache Maven]]
  
 
=refences=
 
=refences=
 +
[https://www.runoob.com/maven/maven-tutorial.html Maven 教程 ]
 +
 
[https://blog.csdn.net/smilecall/article/details/56288972  Spring Boot Maven 打包可执行Jar文件!]
 
[https://blog.csdn.net/smilecall/article/details/56288972  Spring Boot Maven 打包可执行Jar文件!]
  

2024年10月2日 (三) 08:21的最新版本

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仓库安装配置及使用