00-ox-deploy

usage: mvn [options] [<goal(s)>] [<phase(s)>]

Options:
 -am,--also-make                        If project list is specified, also
                                        build projects required by the
                                        list
 -amd,--also-make-dependents            If project list is specified, also
                                        build projects that depend on
                                        projects on the list
 -B,--batch-mode                        Run in non-interactive (batch)
                                        mode (disables output color)
 -b,--builder <arg>                     The id of the build strategy to
                                        use
 -C,--strict-checksums                  Fail the build if checksums don't
                                        match
 -c,--lax-checksums                     Warn if checksums don't match
 -cpu,--check-plugin-updates            Ineffective, only kept for
                                        backward compatibility
 -D,--define <arg>                      Define a system property
 -e,--errors                            Produce execution error messages
 -emp,--encrypt-master-password <arg>   Encrypt master security password
 -ep,--encrypt-password <arg>           Encrypt server password
 -f,--file <arg>                        Force the use of an alternate POM
                                        file (or directory with pom.xml)
 -fae,--fail-at-end                     Only fail the build afterwards;
                                        allow all non-impacted builds to
                                        continue
 -ff,--fail-fast                        Stop at first failure in
                                        reactorized builds
 -fn,--fail-never                       NEVER fail the build, regardless
                                        of project result
 -gs,--global-settings <arg>            Alternate path for the global
                                        settings file
 -gt,--global-toolchains <arg>          Alternate path for the global
                                        toolchains file
 -h,--help                              Display help information
 -l,--log-file <arg>                    Log file where all build output
                                        will go (disables output color)
 -llr,--legacy-local-repository         Use Maven 2 Legacy Local
                                        Repository behaviour, ie no use of
                                        _remote.repositories. Can also be
                                        activated by using
                                        -Dmaven.legacyLocalRepo=true
 -N,--non-recursive                     Do not recurse into sub-projects
 -npr,--no-plugin-registry              Ineffective, only kept for
                                        backward compatibility
 -npu,--no-plugin-updates               Ineffective, only kept for
                                        backward compatibility
 -nsu,--no-snapshot-updates             Suppress SNAPSHOT updates
 -ntp,--no-transfer-progress            Do not display transfer progress
                                        when downloading or uploading
 -o,--offline                           Work offline
 -P,--activate-profiles <arg>           Comma-delimited list of profiles
                                        to activate
 -pl,--projects <arg>                   Comma-delimited list of specified
                                        reactor projects to build instead
                                        of all projects. A project can be
                                        specified by [groupId]:artifactId
                                        or by its relative path
 -q,--quiet                             Quiet output - only show errors
 -rf,--resume-from <arg>                Resume reactor from specified
                                        project
 -s,--settings <arg>                    Alternate path for the user
                                        settings file
 -t,--toolchains <arg>                  Alternate path for the user
                                        toolchains file
 -T,--threads <arg>                     Thread count, for instance 2.0C
                                        where C is core multiplied
 -U,--update-snapshots                  Forces a check for missing
                                        releases and updated snapshots on
                                        remote repositories
 -up,--update-plugins                   Ineffective, only kept for
                                        backward compatibility
 -v,--version                           Display version information
 -V,--show-version                      Display version information
                                        WITHOUT stopping build
 -X,--debug                             Produce execution debug output

1. 界面上传

image-20230911143029244
SGRmWGNyaWlTSm5kTGhLWkwyVGhNMmNHUjBHRWJWWlA5WnR6R3BOWnVBPT0=
dlNKSEFVdG5OVXlYZVBzNTFQdTZoR2NHUjBHRWJWWlA5WnR6R3BOWnVBPT0=
aithYkRyNVMvSzBCMlFDVk5qcWloV2NHUjBHRWJWWlA5WnR6R3BOWnVBPT0=
WWxWVFBWWVFWQi9qYkE4VWR6UmttR2NHUjBHRWJWWlA5WnR6R3BOWnVBPT0=
TjUzemQyRG1FN04vTUJzYjAxc1oxR2NHUjBHRWJWWlA5WnR6R3BNPQ==
  • 删除jar
SmtkcnpsbWloVktpdWZwQ0phcWFyMmNHUjBHRWJWWlA5WnR6R3BOWnVBPT0=

2. 上传release

  • 只能上传RELEASE包。修改文件名即可
  • RELEASE只能上传一次,不能覆盖。但可以浏览器删除
# -Dfile:待上传jar路径
# -DgroupId:`<groupId>`
# -DartifactId:`<artifactId>`
# -Dversion:`<version>`
mvn deploy:deploy-file \
-Dfile=/Users/listao/Downloads/ooxx-RELEASE.jar \
-DgroupId=com.listao.ooxx \
-DartifactId=ooxx-client \
-Dversion=2.8.10-RELEASE \
-Dpackaging=jar \
-DgeneratePom=true \
-Durl=http://192.168.*.*:8081/repository/maven-releases/ \
-DrepositoryId=test

1. <parent>bug

[ERROR] Failed to execute goal on project listao-shop: Could not resolve dependencies for project com.listao:ooxx:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.listao.ooxx:ooxx-client:jar:2.8.9-RELEASE: Failed to read artifact descriptor for com.listao.ooxx:ooxx-client:jar:2.8.9-RELEASE: Could not find artifact com.listao.ooxx:ooxx:pom:1.1.0-SNAPSHOT in test (http://192.168.*.*:8081/repository/maven-public/) -> [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/DependencyResolutionException
  • 上传的jar包含<parent>,还会去循环依赖。因此需要编辑jar
  • 删除parent即可
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.listao.ooxx</groupId>
        <artifactId>ooxx</artifactId>
        <version>1.1.0-SNAPSHOT</version>
    </parent>
    <groupId>com.listao.ooxx</groupId>
    <artifactId>ooxx-client</artifactId>
    <version>1.1.0-SNAPSHOT</version>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>
    <dependencies>
        <dependency>
            <groupId>com.listao</groupId>
            <artifactId>comm-util</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>spring-boot-starter-data-redis</artifactId>
                    <groupId>org.springframework.boot</groupId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
</project>





 
 
 
 
 






















2. 编辑jar

  • 7-Zip => 打开压缩包 => 将pom.xml拖出来,修改完再覆盖回去即可
cTFVQlJ3eko2OFduMHVNZ3M1U3NsMmNHUjBHRWJWWlA5WnR6R3BOWnVBPT0=
V0NyWTF6eEQ2ZEZ3bGVmcGxmaUtSR2NHUjBHRWJWWlA5WnR6R3BOWnVBPT0=

3. 上传snapshot

  • -DrepositoryId=al 为配置文件里的id
mvn deploy:deploy-file \
-Dfile=/Users/listao/Downloads/ooxx-1.3.0.jar \
-DgroupId=com.listao.ooxx \
-DartifactId=ooxx \
-Dversion=1.3.0-SNAPSHOT \
-Dpackaging=jar \
-DgeneratePom=true \
-Durl=http://listao.cn:20011/repository/maven-snapshots/ \
-DrepositoryId=test
bXR5V04vaGlCME1GRWk1M0R2Ry95V2NHUjBHRWJWWlA5WnR6R3BOWnVBPT0=

4. 设置权限

1. 匿名账号

image-20231023192744980

2. 开发账号创建

image-20231023230531652
V3pSQnhVWWdDZ2NLNngxZC9rdjNIR2NHUjBHRWJWWlA5WnR6R3BOWnVBPT0=

3. setting.xml

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

    <localRepository>/Users/listao/.m2/repository</localRepository>
    <pluginGroups>
    </pluginGroups>
    <proxies>
    </proxies>
    <servers>
        <server>
            <id>ox</id>
            <username>admin</username>
            <password>******</password>
        </server>
    </servers>
    <mirrors>
        <mirror>
            <id>ox</id>
            <name>maven-public</name>
            <url>http://ip:port/repository/maven-public/</url>
            <mirrorOf>*</mirrorOf>
        </mirror>
    </mirrors>
    <profiles>
        <profile>
            <id>ox</id>
            <repositories>
                <repository>
                    <id>test</id>
                    <url>http://ip:port/repository/maven-public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>ox</activeProfile>
    </activeProfiles>
</settings>