简体   繁体   中英

mvn archetype:generate using internal maven repo

I wanted to create a maven project using "mvn archetype:generate..." to create a maven project Skeleton. I looked up online and come up with this:

in settings.xml

<profile>
    <id>PlatMigr</id>
    
    <repositories>
        <repository>
            <id>internal repo</id>
            <name>IT Maven Central</name>
            <url>https://<internal maven repo></url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
</profile>

From command line:

mvn archetype:generate -DarchetypeCatalog=internal -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.myproj -DartifactId=ProjName

However maven still tried to download artifacts from official central maven repo:

Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom

We have a firewall installed to stop internet access, that's why I struggle to use internal repo in the first place. Anyone can advise on how to setup and use internal repo to create maven projects?

Edit you settings.xml in m2_home, add mirror to you nexus and create & set to active profile without central repositories

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM