I was able to get a working pom.xml in our development environment, however 
when I transferred this pom to an production, air-gapped environment, it 
continues to output the following error:  unable to resolve artifact

I am not a software developer, I'm a system engineer and a lot of the pom.xml 
files that I've inherited aren't uniform between each other, so please bear 
with me as I've been trying to figure this out for months.

Environment:
RHEL 8.2 OS
Apache Maven 3.5.4 (currently installed)
Java Version:  1.8.0_222 (currently installed and added java path to my .bashrc 
file under my home directory and output of $JAVA_HOME shows 
/etc/alternatives/jre_1.8.0_openjdk.  Not sure if this is the Java that I'm 
supposed to use, however I don't get any type of Java errors when trying to run 
this.)


When I execute the pom with the following command:  mvn dependency:copy -f 
pom.xml -s ~/.m2/settings.xml

This is some of the output that I'm getting, the download part is odd, as it 
has the group ID, artifact ID and version ID along with the name of the ISO I'm 
trying to download from a Nexus repo.

"Downloading from central:  
https://repo.maven.apache.org/maven2/<groupID>/<artifactID>/<versionID><release_number>/<name<https://repo.maven.apache.org/maven2/%3cgroupID%3e/%3cartifactID%3e/%3cversionID%3e%3crelease_number%3e/%3cname>
 of ISO here>

Error failed to execute goal 
org.apache.maven.plugins:maven-dependency-plugin:2.8copy (default-cli) on
Project <artifactID here>: Unable to resolve artifact
Could not transfer artifact <groupid>:<artifactid>:iso:<version_number> from/to 
central
(https://repo.maven.apache.org/maven2):
repo.maven.apache.org: Name or service not known"


Here is my pom.xml.  I've modeled this after the best practice put out by 
apache/maven for using dependency:copy

https://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html

<modeVersion>4.0.0</modeVersion>

<groupId>group_ID_here</groupId>
<artifactId>artifact_ID_here</artifactId>
<version>version_of_iso</version>

<properties>
  <depStagingArea>/dropbox/</depStagingArea>
</properties>

<build>
  <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.8</version>       
<------------------------------------------------How do I know what version 
number this is suppose to be and will work correctly with the version of Maven 
that I have?
           <configuration>
             <artifactItems>
               <artifactItem>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>artifact_ID_goes_here</artifactId>
                 <version>${project.version</version>
                 <type>iso</type>
                 <overWrite>false</overWrite>
                 <outputDirectory>${depStagingArea}</outputDirectory>
                 <destFileName>${downloadFilename}</destFileName>
               </artifactItem>
             </artifactItems>
           </configuration>
         </plugin>
       </plugins>
     </build>


This is my settings.xml file

<settings xmlns = >
<servers>
  <server>
    <id>ID_goes_here</id>
    <username>username_goes_here</username>
    <password>password_goes_here</password>
    <filePermissions>664</filePermissions>
    <directoryPermission>775</directoryPermission>
  </server>
</servers>

<profiles>
  <profile>
    <id>nexus</id>
     <repositories>
     <repository>
       <id>ID_goes_here</ID>
       <URL>URL_goes_here</URL>
       <releases><enabled>true</enabled></releases>
    </repository>
    </repositories>
  </profile>
  </profiles>
</settings>


Thanks

Chris

Reply via email to