mavencentralでlibを公開する

序文



私は何か役に立つことをすることにしました。新しいものを作らなければならないプロジェクトがありましたが、古いサービスの代わりにもっと良いものでした。このサービスは素晴らしいです。1万行のビジネスルールと1万5千行のJavaコードです。今では2倍になっています。しかし、ロジックがたくさんあり、誰もあまり覚えていないので(そのため、テスト、ドック、最小限のバグが必要でした)、古いサービスと新しいサービスを比較する必要がありました。私たちのテスターが老齢で死なないように、すべてをチェックしようとして、私は古いAPIと新しいAPIをプルし、回答の違いを比較してデータベースにマージするサービスを考えて作成しました。これにより、テスターがチェックし、違いを修正します。しかし、ここに問題があります。入力には多くのパラメーターとそれらの可能な値があり、これらは数十億の組み合わせであり、全負荷で数か月間チェックされ、同様のものが多数あります。

その結果、最初は、パラメータの可能な変更を取り込んで削減し、一般的に列挙の一部を破棄するというアイデアが生まれました。次に、ペアワイズテスト理論が採用され、すべてのパラメータとすべての値をスローし、すべてを完全にチェックすることができました。







この単純な理論では、パラメーターの各ペアが少なくとも1回発生するテストケースを作成すると、バグのほぼ90%をカバーできると主張しています。同時に、数十億のテストケースではなく、おそらく数千のテストケースが存在するようにすべてを選択できます。素晴らしい結果です!その結果、レガシーサービスに何百もの不一致や多数のバグが見つかり、ビジネスロジックの作成者に、これまで考えたことのないことを考えさせました。これは、「どのように」が明確でない新しい興味深いテストケースを投げただけだからです。正しい"。







コードが書かれ、すべてが機能し、誰もが満足していますが、どういうわけか私はテストケースジェネレータを捨てたくなかったので、週末に座って、作業サービスと同じアルゴリズムを使用するライブラリを作成しましたが、lombok以外のすべてから完全に切り離されて作成されました営業時間外。したがって、mavencentralでApache2.0ライセンスの下で公開したかったのです。しかし、それはとても退屈で説明が不十分だったので、私は自分自身にハブレについてのメモを残すことに決めました。それで、後で突然、私は二度と苦しむことはありませんでした。







突然必要になった場合は、libkaがここに公開されます







じゃ、行こう。







sonatype.orgに登録する



Maven Centralに直接公開することは、そのようには機能しないため、中間サービスsonatype.orgを使用しました。まず、そこで登録する必要があります。







彼らはすべてを解放する方法についてのドキュメントを持っています







, pom.xml









: gnupg, maven release plugin . , git , . . . .







GNUpg



. , , . , . , GUI , . gpa , .







:







  1. .

    Imgur
  2. Ctrl+N.
  3. .
  4. , sonatype.org , . "" " ".

    Imgur

    .


settings.xml



Maven. sonatype.org ( ), .







<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 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <servers>
    <server>
      <id>ossrh</id>
      <username>3DRaven</username>
      <password>passwordForYourAccountInSonata</password>
    </server>
  </servers>
  <mirrors/>
  <proxies/>
  <profiles>
    <profile>
      <id>ossrh</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <gpg.executable>gpg2</gpg.executable>
        <gpg.passphrase>passwordForGPGKey</gpg.passphrase>
      </properties>
    </profile>
  </profiles>
  <activeProfiles/>
</settings>
      
      





ossrh .







pom.xml



, javadoc, source. . ,













<description>Generate array of minimal size of pairwise tests cover all pairs of changing params</description>
    <url>https://github.com/3DRaven/pairwiser</url>
    <inceptionYear>2020</inceptionYear>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>
    <developers>
        <developer>
            <id>3DRaven</id>
            <name>Renat Eskenin</name>
            <email>email</email>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:ssh://git@github.com:3DRaven/pairwiser.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:3DRaven/pairwiser.git</developerConnection>
        <tag>HEAD</tag>
        <url>https://github.com/3DRaven/pairwiser</url>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/3DRaven/pairwiser/issues</url>
    </issueManagement>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
      
      





distributionManagement. , , id ossrh settings.xml . , javadoc source. profiles , . .







<profiles>
        <!-- GPG Signature on release -->
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven.source.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
      
      





sonatype.org, staging . . Open . , "", . sonatype.org .







<plugin>
    <groupId>org.sonatype.plugins</groupId>
    <artifactId>nexus-staging-maven-plugin</artifactId>
    <version>${nexus.staging.maven.plugin.version}</version>
    <extensions>true</extensions>
    <configuration>
        <serverId>ossrh</serverId>
        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
        <autoReleaseAfterClose>true</autoReleaseAfterClose>
    </configuration>
</plugin>
      
      







sonatype.org , , . Jira .







staging



, , , , sonatype.org







mvn release:clean release:prepare 
mvn release:perform
      
      





, , , "Close".









, , , . , Maven Central . ( ) . "", Close. , Release Drop. . , , Maven Central







!









  1. sonatype.org
  2. settings.xml
  3. pom.xml
  4. sonatype.orgにアクセスして、リポジトリを閉じ、解放し、ドロップします
  5. 利益!!!



All Articles