2

開発マシンの 1 つに Nexus 2.1.2 をインストールしたところです。それを中央リポジトリのプロキシとして、またスナップショットとリリースの内部リポジトリとして使用したいと考えています。これを設定する方法について Sonatype の例に従おうとしましたが、POM で大量のエラーが発生し続けます (Eclipse と m2e を使用しています)。エラーは次のとおりです。

現在のプロジェクトとリポジトリ [ローカル (C:\Users\jwolinsk.m2\repository)、nexus (http://xxxxxxdev9:8081/nexus/) から利用可能なプラグイン グループ [] でプレフィックス「war」のプラグインが見つかりませんコンテンツ/リポジトリ/グループ/パブリック)]

現在のプロジェクトとリポジトリ [local (C:\Users\jwolinsk.m2\repository)、nexus (http://jc1lkddev9:8081/nexus/コンテンツ/リポジトリ/グループ/パブリック)]

これが私のsettings.xmlです:

<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
    <proxies>
        <proxy>
            <active>true</active>
            <protocol>http</protocol>
            <port>8080</port>
            <host>xxxxprxy2</host>
            <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
            <id>httpProxy</id>
        </proxy>
    </proxies>
    <mirrors>
        <mirror>
            <id>nexus</id>
            <mirrorOf>*</mirrorOf>
            <url>http://xxxxxdev9:8081/nexus/content/repositories/groups/public</url>
        </mirror>
    </mirrors>
    <profiles>
        <profile>
            <id>local</id>
            <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>local</activeProfile>
    </activeProfiles>
</settings>

そして、ここに私の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>
    <groupId>com.ks</groupId>
    <artifactId>kdweb</artifactId>
    <name>kdweb</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>
    <properties>
        <org.springframework-version>3.1.2.RELEASE</org.springframework-version>
        <org.slf4j-version>1.5.10</org.slf4j-version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>com.ks</groupId>
            <artifactId>acommons</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.ks</groupId>
            <artifactId>aggregation-common</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.2.2</version>
        </dependency>
        <dependency>
            <groupId>commons-pool</groupId>
            <artifactId>commons-pool</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-core-asl</artifactId>
            <version>1.9.9</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.9</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-asm</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>commons-digester</groupId>
            <artifactId>commons-digester</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.ks.thirdparty</groupId>
            <artifactId>jconn</artifactId>
            <version>3</version>
        </dependency>
        <dependency>
            <groupId>com.ks</groupId>
            <artifactId>framework-common</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.ks.thirdparty</groupId>
            <artifactId>ojdbc6_g</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
4

3 に答える 3

3

あなたはこれを試すことができます:

<mirror>
    <id>nexus-local</id>
    <url>http://xxxxxx:8081/nexus/content/groups/public/</url>
    <mirrorOf>external:*</mirrorOf>
</mirror>
<mirror>
    <id>nexus.snapshots-local</id>
    <url>http://xxxxx:8081/nexus/content/repositories/snapshots/</url>
    <mirrorOf>snapshots</mirrorOf>
</mirror>

それ以外の場合は、Nexusでライブラリが正しくダウンロードされていることを確認してください。nexusでネットワークの問題が発生している可能性があるため、Webにアクセスできず、プラグインや依存関係をダウンロードできません。

プロキシの背後にいる場合は、Nexusでプロキシを構成する必要があります。

管理->サーバー->デフォルトのHTTPプロキシ設定

ここに画像の説明を入力してください

于 2012-09-14T15:34:13.900 に答える
0

nexus OSS インストールが Web にアクセスできることを確認するには、管理者としてログインし、Repositories(左側の [リポジトリ] をクリックして) を開き、デフォルトのCentralリポジトリを選択し、下部のビューでBrowse Remoteタブを選択し、最後にボタンを選択しRefreshます。セントラル リポジトリで利用可能なすべてのコンポーネントが表示されます (つまり、nexus は Web に接続できます)。(注: この寄稿はコメントである必要がありましたが、まだコメントすることはできません)。

于 2012-09-14T17:51:58.400 に答える
0

まず、設定のプロキシ セクションを削除します。次に、開発マシンから Nexus インスタンスに接続できることを確認します。最後に、Nexus でプロキシ設定を構成することにより、Nexus が中央レポおよびプロキシしたいものすべてに到達できることを確認します。

Nexus は、settings.xml からのプロキシ設定を考慮しません (それらはマシンに対してローカルであり、意味をなさない Nexus サーバーではないため)。

于 2012-09-15T04:59:20.980 に答える