Felhasználói eszközök

Eszközök a webhelyen


oktatas:programozas:java:sonatype

< Java

Sonatype

Regisztráció

Hozzáférés beállítása

  • /home/user/.m2/settings.xml
settings.xml
<settings>
  <servers>
    <server>
      <id>central</id>
      <username>token user</username>
      <password>token password</password>
    </server>
  </servers>
</settings>

JAVA_HOME

Állítsuk be a környezeti változót. Például:

export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/

mvn parancs

Szükségünk van egy mvn parancsra.

Linuxon:

apt install maven

Publikálás mvn paranccsal

.pom fájl:

pom.xml
<project>
    <modelVersion>4.0.0</modelVersion>
 
    <groupId>foo.bar</groupId>
    <artifactId>myproject</artifactId>
    <version>0.1.0</version>
 
    <name>myproject</name>
    <description>Project demo</description>
    <url>https://foo.bar/</url>    
 
    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>        
    </properties>
 
    <dependencies>
        <!--...-->
    </dependencies>
 
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.10.1</version>
                <configuration>
                    <outputDirectory>${basedir}/docs</outputDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</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>3.4.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.5</version>
                <executions>
                <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                <goal>sign</goal>
                </goals>
                </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.6.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                </configuration>
            </plugin>
        </plugins>
    </build>
 
  <licenses>
    <license>
      <name>MIT License</name>
      <url>https://opensource.org/license/mit</url>
    </license>
  </licenses>
 
  <developers>
    <developer>
      <name>My Name</name>
      <email>someone@foo.bar</email>
      <organization>Name</organization>
      <organizationUrl>https://foo.bar</organizationUrl>
    </developer>
  </developers>
 
  <scm>
    <connection>scm:git:git://github.com/someone/myproject.git</connection>
    <developerConnection>scm:git:ssh://github.com:soneone/myproject.git</developerConnection>
    <url>https://github.com/someone/myproject/tree/master</url>
   </scm>
 
</project>

Publikáció

mvn clean install
mvn deploy

A weboldalon folytassuk:

Moduláris

Moduláris alkalmazás esetén szükség van module-info.java fájlra.

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                </configuration>                
            </plugin>
oktatas/programozas/java/sonatype.txt · Utolsó módosítás: 2024/11/10 00:46 szerkesztette: admin