gc-guide/src/content/NexusUsage.tsx

117 lines
4.5 KiB
TypeScript
Raw Normal View 히스토리

import { Alert } from '../components/common/Alert';
import { CodeBlock } from '../components/common/CodeBlock';
export default function NexusUsage() {
return (
<div className="max-w-4xl mx-auto py-12 px-6">
<h1 className="text-3xl font-bold text-text-primary mb-2">Nexus </h1>
<p className="text-text-secondary mb-8">
Maven, Gradle, npm .
</p>
<Alert type="info" title="Nexus 주소">
<strong>nexus.gc-si.dev</strong> UI에서 .
</Alert>
{/* Maven */}
<h2 className="text-xl font-bold text-text-primary mt-10 mb-4">Maven </h2>
<p className="text-text-secondary mb-4">
Maven Nexus를 <code className="bg-bg-tertiary px-1 rounded">~/.m2/settings.xml</code> .
</p>
<CodeBlock
language="xml"
filename="~/.m2/settings.xml"
code={`<settings>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>https://nexus.gc-si.dev/repository/maven-public/</url>
</mirror>
</mirrors>
<servers>
<server>
<id>nexus</id>
<username>\${env.NEXUS_USERNAME}</username>
<password>\${env.NEXUS_PASSWORD}</password>
</server>
</servers>
</settings>`}
/>
{/* Gradle */}
<h2 className="text-xl font-bold text-text-primary mt-10 mb-4">Gradle </h2>
<p className="text-text-secondary mb-4">
<code className="bg-bg-tertiary px-1 rounded">build.gradle</code> repositories Nexus를 .
</p>
<CodeBlock
language="groovy"
filename="build.gradle"
code={`repositories {
maven {
url 'https://nexus.gc-si.dev/repository/maven-public/'
credentials {
username = findProperty('nexusUsername') ?: System.getenv('NEXUS_USERNAME')
password = findProperty('nexusPassword') ?: System.getenv('NEXUS_PASSWORD')
}
}
}`}
/>
<Alert type="info">
<code className="bg-bg-tertiary px-1 rounded">~/.gradle/gradle.properties</code> <code className="bg-bg-tertiary px-1 rounded">nexusUsername</code>/<code className="bg-bg-tertiary px-1 rounded">nexusPassword</code> .
</Alert>
{/* npm */}
<h2 className="text-xl font-bold text-text-primary mt-10 mb-4">npm </h2>
<p className="text-text-secondary mb-4">
<code className="bg-bg-tertiary px-1 rounded">.npmrc</code> Nexus .
</p>
<CodeBlock
language="ini"
filename=".npmrc"
code={`registry=https://nexus.gc-si.dev/repository/npm-public/
//nexus.gc-si.dev/repository/npm-public/:_auth=\${NPM_AUTH_TOKEN}
always-auth=true`}
/>
<Alert type="warning" title="보안 주의">
<code className="bg-bg-tertiary px-1 rounded">_auth</code> <code className="bg-bg-tertiary px-1 rounded">.npmrc</code> . <code className="bg-bg-tertiary px-1 rounded">~/.npmrc</code>() , <code className="bg-bg-tertiary px-1 rounded">.npmrc</code> URL .
</Alert>
{/* 패키지 배포 */}
<h2 className="text-xl font-bold text-text-primary mt-10 mb-4"> </h2>
<p className="text-text-secondary mb-4">
Nexus에 .
</p>
<h3 className="text-lg font-semibold text-text-primary mt-6 mb-3">Maven </h3>
<CodeBlock
language="xml"
filename="pom.xml"
code={`<distributionManagement>
<repository>
<id>nexus</id>
<url>https://nexus.gc-si.dev/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<url>https://nexus.gc-si.dev/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>`}
/>
<CodeBlock language="bash" code="mvn deploy" />
<h3 className="text-lg font-semibold text-text-primary mt-6 mb-3">npm </h3>
<CodeBlock
language="json"
filename="package.json"
code={`{
"publishConfig": {
"registry": "https://nexus.gc-si.dev/repository/npm-hosted/"
}
}`}
/>
<CodeBlock language="bash" code="npm publish" />
</div>
);
}