1
votes

I have an Eclipse project that I am trying to build using Maven, with JAR files that reside on my private Artifactory server and a few other Maven repositories.

In my POM file (prior to adding my Artifactory repository) I had the repositories specified:

 <repositories>
 <repository>
    <id>third-party</id>
    <name>Atlassian 3rdParty</name>
    <url>https://repo.spring.io/plugins-release/</url>
 </repository>
 <repository>
    <id>ICM</id>
    <name>ICM Repository</name>
    <url>http://maven.icm.edu.pl/artifactory/repo/</url>
 </repository>
 </repositories>

The repositories enable me to access several libraries that I need for the build, including (but not exclusively):

      ...
    <dependency>
       <groupId>xerces</groupId>
       <artifactId>xerces</artifactId>
       <version>2.4.0</version>
   </dependency>     
   <dependency>
     <groupId>com.oracle</groupId>
     <artifactId>ojdbc6</artifactId>
     <version>11.2.0.3</version>
   </dependency>
   <dependency>
     <groupId>com.sun.mail</groupId>
     <artifactId>javax.mail</artifactId>
   </dependency>
       ...

I have a couple of JAR files that I would like to access from my Artifactory server. These files are in a repository I created called Factor_Snapshot, and there are two of them: factorbase-1.0.0.jar and lowerbase-1.0.0.jar.

In order to get everything through Artifactory (properly using it as a proxy for the remore repositories, I added those repositories to Artifactory. I then used the "set me up" link in an attempt to generate proper entries for the POM file.

One thing I noticed was that I cannot seem to get the generated entries to include the Factor_Snapshot repository. generated entries only seem to include the libs-release and libs-snapshot repos that were there before. When I click on Generate Maven Settings and select a snapshot, I am only allowed to select libs-snapshot, gradle-dev, libs-release, etc. My snapshot repo, Factor_Snapshot, cannot be selected. The generated settings are shown below:

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>${security.getCurrentUsername()}</username>
      <password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password>
      <id>central</id>
    </server>
    <server>
      <username>${security.getCurrentUsername()}</username>
      <password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password>
      <id>snapshots</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://192,168.1.230:8081/artifactory/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://192,168.1.230:8081/artifactory/libs-snapshot</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://192,168.1.230:8081/artifactory/libs-release</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://192,168.1.230:8081/artifactory/libs-snapshot</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

Of course, since there doesn't seem to be a settings.xml file for putting in active profiles in Eclipse, I doubted that I could use this file anyway. Also: it is unclear how to get the encrypted passwords referenced in the file.

I added the following dependencies, based on how I saw them organized on my Artifactory server:

      ...
   <dependency>
      <groupId>com.factor3</groupId>
      <artifactId>lowerbase</artifactId>
      <version>1.0.0</version>
    </dependency>
   <dependency>
      <groupId>com.factor3</groupId>
      <artifactId>factorbase</artifactId>
      <version>1.0.0</version>
   </dependency>
       ...

I believe I set them up correctly. I did get error messages once I saved the POM file saying that the artifacts lowerbase:jar and factorbase:jar were missing. This was expected because I hadn't put in the repository declaration yet.

I did end up guessing about the repo declaration, so I created the following entries in my POM file, based on Artifactory documentation and the way the repo was set up:

 <repositories>
    <repository>
      <id>snapshots</id>
      <name>soliandisk</name>
     <url>http://192,168.1.230:8081/artifactory/Factor_Snapshot</url>
 </repository>
 <repository>
    <id>third-party</id>
    <name>Atlassian 3rdParty</name>
    <url>https://repo.spring.io/plugins-release/</url>
 </repository>
 <repository>
    <id>ICM</id>
    <name>ICM Repository</name>
    <url>http://maven.icm.edu.pl/artifactory/repo/</url>
 </repository>
 </repositories>

But when I added the Factor_Snapshot repository, now I get failures saying all the JAR file artifacts are missing -- even the factorbase and lowerbase artifacts!

I know I am missing something in the configuration, but I don't know what.

How do I configure Artifactory and my POM file so I can get all my necessary JARs?

1

1 Answers

1
votes

Your URL, http://192,168.1.230:8081, contains a comma , instead of a period ..