2017-03-08 13 views
0

하나의 Maven 아키타 입을 만들고 Nexus 저장소에 업로드했습니다. Windows에서 "mvn archetype : generate -DarchetypeCatalog = http://myhost:8080/nexus/content/repositories/my-snapshots/archetype-catalog.xml"명령을 사용하여 해당 아키타 입을 기반으로 한 프로젝트를 생성 할 수 있습니다. 카탈로그 xml 유효하며 브라우저에서 수동으로 열 수 있습니다.원격 http archetypeCatalog가 Linux에서 작동하지 않습니다.

이제 Linux에서 동일한 단계를 수행하고 conf/setting.xml의 서버 파트 및 저장소 프로필을 Windows와 동일한 콘텐츠로 구성했습니다. maven이 "카탈로그가 정의되지 않았습니다. 내부 카탈로그 사용"을보고했습니다. Maven이 "-DarchetypeCatalog = ...."부분을 읽지 않은 것으로 보입니다.

디버그 로그는 다음과 같습니다. Maven 버전은 3.3.9입니다. 이 문제는 Redhat과 Ubuntu에서 재현되었습니다. 누군가가 해결책을 제안 할 수 있기를 바랍니다. 감사.

모든 저장소의 거울로 넥서스를 구성하면
<mirrors> 
    <mirror> 
    <name>Local Nexus Mirror</name> 
    <id>nexus</id> 
    <mirrorOf>*</mirrorOf> 
    <url>http://myhost:8080/nexus/content/groups/public</url> 
    </mirror> 
</mirrors> 

, 메이븐 지금 대신 넥서스의 로컬 설치를 참조합니다 :

[DEBUG] RuntimeInstance successfully initialized. 
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate' with basic configurator --> 
[DEBUG] (f) archetypeCatalog = http://myhost:8080/nexus/content/repositories/my-snapshots/archetype-catalog.xml 
[DEBUG] (f) basedir = /opt/testmaven 
[DEBUG] (f) interactiveMode = true 
[DEBUG] (f) localRepository =  id: local 
     url: file:///root/.m2/repository/ 
    layout: default 
snapshots: [enabled => true, update => always] 
releases: [enabled => true, update => always] 

[DEBUG] (f) remoteArtifactRepositories = [  id: my-snapshots 
     url: http://myhost:8080/nexus/content/repositories/my-snapshots 
    layout: default 
snapshots: [enabled => true, update => always] 
releases: [enabled => false, update => always] 
,  id: central 
     url: https://repo.maven.apache.org/maven2 
    layout: default 
snapshots: [enabled => false, update => daily] 
releases: [enabled => true, update => daily] 
] 
[DEBUG] (f) session = [email protected] 
[DEBUG] -- end configuration -- 
[INFO] Generating project in Interactive mode 
[INFO] No catalog defined. Using internal catalog 
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0) 
Choose archetype: 
1: internal -> org.apache.maven.archetypes:maven-archetype-archetype (An archetype which contains a sample archetype.) 
....... 

답변

0

는 Settings.XML이, 우리는 거울을 구성해야 중앙 Maven 저장소로 나가는 것.

Nexus에 요청 된 이슈가있는 경우 이슈는 로컬 Nexus 설치에서 제공됩니다.

mvn archetype:generate을 통해 메이븐 아티팩트를 생성하면서 -DarchetypeCatalog=remote 또는 -DarchetypeCatalog=local을 지정할 수 있습니다.

archetype-cataog를 로컬에서 사용할 수 있다면 -Dcatalog=<url>

을 직접 사용할 수 있습니다.