Nexus:Maven: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 111: Line 111:
     <profile>
     <profile>
       <id>academia</id>
       <id>academia</id>
      <properties>
        <altSnapshotDeploymentRepository>academia.snapshots::default::https://cdn.chorke.org/nexus/repository/m2-snapshots</altSnapshotDeploymentRepository>
        <altReleaseDeploymentRepository>academia.releases::default::https://cdn.chorke.org/nexus/repository/m2-releases</altReleaseDeploymentRepository>
      </properties>
       <repositories>
       <repositories>
         <repository>
         <repository>
Line 175: Line 179:


==Redirections==
==Redirections==
'''for older version only'''
  ${NEXUS_INSTALL_DIR}/conf/nexus.properties
  ${NEXUS_INSTALL_DIR}/conf/nexus.properties
nano /opt/sonatype/nexus3/etc/nexus-default.properties


<source lang="properties">
<source lang="properties">
Line 184: Line 188:


==References==
==References==
* [https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9016 Maven Local Settings for Oracle to Configure the HTTP Wagon]
* [https://blogs.oracle.com/dev2dev/get-oracle-jdbc-drivers-and-ucp-from-oracle-maven-repository-without-ides Oracle JDBC drivers and UCP from Oracle Maven Repository]
* [https://support.sonatype.com/hc/en-us/articles/213465728-How-to-configure-a-proxy-repository-to-maven-oracle-com Configure a proxy repository for <code>maven.oracle.com</code>]
* [https://support.sonatype.com/hc/en-us/articles/213465728-How-to-configure-a-proxy-repository-to-maven-oracle-com Configure a proxy repository for <code>maven.oracle.com</code>]
* [https://help.sonatype.com/repomanager3/repository-management#RepositoryManagement-ManagingRepositoriesandRepositoryGroups Managing Repositories and Repository Groups]
* [https://help.sonatype.com/repomanager3/repository-management#RepositoryManagement-ManagingRepositoriesandRepositoryGroups Managing Repositories and Repository Groups]
* [https://blog.sonatype.com/using-nexus-3-as-your-repository-part-1-m2-artifacts Configure Nexus Maven Repository]
* [https://blog.sonatype.com/using-nexus-3-as-your-repository-part-1-m2-artifacts Configure Nexus Maven Repository]
* [https://help.sonatype.com/repomanager3/formats/maven-repositories Nexus Maven Repositories]
* [https://help.sonatype.com/repomanager3/formats/maven-repositories Nexus Maven Repositories]
* [[Maven]]
* [[Nexus]]
* [[Nexus]]

Latest revision as of 05:14, 16 October 2023

Recipe Types:
──────────────────────────────────────────
nexus/repository/recipe/types
─┬────────────────────────────────────────
 │
 ├─ group
 ├─ proxy
 └─ host
Repositories:
──────────────────────────────────────────
https://cdn.chorke.org/nexus/repository/
─┬────────────────────────────────────────
 ├─ m2-snapshots/      [host ]
 ├─ m2-releases/       [host ]
 ├─ m2-central/        [proxy]
 └─ m2/                [group]

Blob Store

Admin   : https://cdn.chorke.org/nexus/#admin/repository/blobstores
Path    : /nexus-data/blobs/m2-snapshots
Name    : m2-snapshots
Admin   : https://cdn.chorke.org/nexus/#admin/repository/blobstores
Path    : /nexus-data/blobs/m2-releases
Name    : m2-releases
Admin   : https://cdn.chorke.org/nexus/#admin/repository/blobstores
Path    : /nexus-data/blobs/m2-public
Name    : m2-central
Admin   : https://cdn.chorke.org/nexus/#admin/repository/blobstores
Path    : /nexus-data/blobs/m2-group
Name    : m2-group

Repository

Admin   : https://cdn.chorke.org/nexus/#admin/repository/repositories
Version : Snapshot
Layout  : Strict
Deploy  : Allow redeploy
Storage : m2-snapshots
Name    : m2-snapshots
Admin   : https://cdn.chorke.org/nexus/#admin/repository/repositories
Version : Release
Layout  : Strict
Deploy  : Disable redeploy
Storage : m2-releases
Name    : m2-releases
Admin   : https://cdn.chorke.org/nexus/#admin/repository/repositories
Version : Release
Layout  : Permissive
proxy   : https://repo1.maven.org/maven2/
Storage : m2-central
Name    : m2-central
Admin   : https://cdn.chorke.org/nexus/#admin/repository/repositories
Members : m2-snapshots, m2-releases, m2-central
Storage : m2-group
Name    : m2

Security

vim $HOME/.m2/settings.xml

NEXUS_M2_AUTH="Basic `echo -n 'academia:sadaqah!'|openssl base64`";\
cat <<EOF >> $HOME/.m2/settings-academia.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <!-- <localRepository>\${user.home}/.m2/repository</localRepository> -->
  <servers>
    <server>
      <id>academia</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>Authorization</name>
            <value>$NEXUS_M2_AUTH</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>

    <server>
      <id>academia.snapshots</id>
      <username>username</username>
      <password>password</password>
    </server>
    <server>
      <id>academia.releases</id>
      <username>username</username>
      <password>password</password>
    </server>
  </servers>

  <mirrors>
    <mirror>
      <id>academia</id>
      <name>academia</name>
      <url>https://cdn.chorke.org/nexus/repository/m2/</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>

  <profiles>
    <profile>
      <id>academia</id>
      <properties>
        <altSnapshotDeploymentRepository>academia.snapshots::default::https://cdn.chorke.org/nexus/repository/m2-snapshots</altSnapshotDeploymentRepository>
        <altReleaseDeploymentRepository>academia.releases::default::https://cdn.chorke.org/nexus/repository/m2-releases</altReleaseDeploymentRepository>
      </properties>
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  
  <activeProfiles>
    <activeProfile>academia</activeProfile>
  </activeProfiles>
</settings>
EOF

vim ./pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <!-- skipped -->

  <distributionManagement>
    <snapshotRepository>
      <id>academia.snapshots</id>
      <url>https://cdn.chorke.org/nexus/repository/m2-snapshots/</url>
    </snapshotRepository>
    <repository>
      <id>academia.releases</id>
      <url>https://cdn.chorke.org/nexus/repository/m2-releases/</url>
    </repository>
  </distributionManagement>
  <!-- skipped -->

  <repositories>
    <repository>
      <id>academia</id>
      <url>https://cdn.chorke.org/nexus/repository/m2/</url>
      <snapshots><enabled>true</enabled></snapshots>
      <releases><enabled>true</enabled></releases>
    </repository>
  </repositories>
  <!-- skipped -->
</project>

mvn clean install
mvn clean deploy -Djava.net.preferIPv4Stack=true

Redirections

for older version only
${NEXUS_INSTALL_DIR}/conf/nexus.properties
nexus.remoteStorage.enableCircularRedirectsForHosts=maven.oracle.com
nexus.remoteStorage.useCookiesForHosts=maven.oracle.com

References