Artifacts are "missing" when using Artifactory - eclipse

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?

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

Related

How to cache artifact from a public repository(e.g., Maven Central) to a private-owned nexus repository?

Basically, I am asking the same thing as the question linked here.
However, I don't think the picked answer solved the question. In addition, the former one was asked years ago.
The Nexus OSS version I installed is 2.11.2-06(the latest version).
I CAN cache an artifact if I search with the nexus GUI and click download button.
However, an artifact IS NOT cached if I declare it in the pom file in eclipse. It will just fetch it from MAVEN CENTRAL and cache it locally in my computer but not in the Nexus Repository.
I WISH when I declare a dependency in the POM file in eclipse, if it is not cached locally, maven will fetch it from MAVEN CENTRAL, cache it both locally in my computer AND in the Nexus Repository as well.
My maven settings.xml is shown below:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>kingstar-internal</id>
<repositories>
<repository>
<id>kingstar-internal-repository</id>
<name>Kingstar Internal Repository</name>
<url>http://localhost:8081/nexus/content/repositories/KingstarRepository</url>
</repository>
<repository>
<id>kingstar-snapshot-repository</id>
<name>Kingstar Snapshot Repository</name>
<url>http://localhost:8081/nexus/content/repositories/KingstarSnapshotRepository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<mirrors>
<mirror>
<id>public-mirror</id>
<mirrorOf>*</mirrorOf>
<name>public mirror</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<activeProfiles>
<activeProfile>kingstar-internal</activeProfile>
</activeProfiles>
<servers>
<server>
<id>kingstar-internal-repository</id>
<username>deployment</username>
<password>deployment</password>
</server>
<server>
<id>kingstar-snapshot-repository</id>
<username>deployment</username>
<password>deployment</password>
</server>
</servers>
</settings>
Any help is appreciated!

How do you pre-compile Drools rules?

I want to pre-compile my .drl files to .class files so they do not have to be compiled a run time. The documentation makes it sounds like the kie-maven-plugin does this, but it is not generating anything for me. It compiles the rules files but does not output anything. Any suggestions?
I'm using the mvn package command, and my pom.xml file is below:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kie</groupId>
<artifactId>kie-parent-with-dependencies</artifactId>
<version>6.0.1.Final</version>
<!-- relativePath causes out-of-date problems on hudson slaves -->
<!--<relativePath>../droolsjbpm-build-bootstrap/pom.xml</relativePath>-->
</parent>
<packaging>kjar</packaging>
<artifactId>default-kiesession</artifactId>
<name>Drools API examples - Default KieSession</name>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>6.0.1.Final</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<repositories>
<!-- Bootstrap repository to locate the parent pom when the parent pom has not been build locally. -->
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
</repositories>
<scm>
<connection>scm:git:git#github.com:droolsjbpm/drools.git</connection>
<developerConnection>scm:git:git#github.com:droolsjbpm/drools.git</developerConnection>
<url>https://github.com/droolsjbpm/drools</url>
</scm>
</project>
There was a bug in 6.0.1.Final that caused the maven plugin to not save the compiled bytecode inside the kjar. It was fixed after, so if you take the 6.0.2-SNAPSHOT (community) version, or the RedHat BRMS 6.0.1.GA (product) version, it will work.
BZ ticket: https://bugzilla.redhat.com/show_bug.cgi?id=1063255
commit that fixes the bug: https://github.com/droolsjbpm/drools/commit/94b9ccf810100c7ec3f8ed186111720ddb2729d3
FYI, when the correct kjar is generated, it contains a kbase.cache file inside the jar for each defined kbase. These cache files contain the compiled bytecode.
It works for me with kie-maven-plugin 6.1.0.Final, but packaging "kjar" should be specified in order to get KIE base cache inside jar file.
It's described in Drools documentation. Just for anybody who find this as first post for 'precompile gdst' on google ;-).
You have to define generateModel=YES when compiling. On mvn command line -DgenerateModel=YES or in pom.xml inside kie-maven-plugin <configuration> secion with <generateModel>YES</generateModel>

maven java.lang.ClassNotFoundException: org.postgresql.Driver

I have added following dependency into maven's pom.xml file
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.0-801.jdbc4</version>
</dependency>
But it has not found the driver for the postgres database ?
Please describe me where is the problem.
It looks like your repo don't have the requested jar. If so, add a repo tag to the pom.xml pointing to the jboss or maven repo.
<project ...>
<repositories>
<repository>
<id>JBoss repository</id>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
</repositories>
</project>
or
<project ...>
<repositories>
<repository>
<id>java.net</id>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
</project>

Why do I see a heavily reduced public JBoss Maven repository in Eclipse?

As you can see in the picture at the end of this post only a few artifacts are available from the JBoss repository in Eclipse. But if you browse it online at https://repository.jboss.org/nexus/index.html#view-repositories;public-jboss~browsestorage there are hundreds. I have rebuilt and updated the index several times. I have checked "Full Index Enabled". I have changed the repository URL from https to http and back. I have searched the web of course but can't fix it. I'm not behind a proxy.
Here is some version information:
Ubuntu 10.10
Eclipse Indigo 3.7.2
Maven 3.0.4
The Maven central repository hosted at Apache is working fine, but the JBoss repository isn't. I have configured Maven with the settings.xml in my ~/.m2/ directory. Whenever I made changes, I have reloaded the settings.xml.
This is my settings.xml
<settings xmlns="http://maven.apache.org/settings/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>jboss-public-repository</id>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>jboss-public-repository</activeProfile>
</activeProfiles>
</settings>
The Maven Repository Browser looks like this
Maven Repository Browser with very few artifacts in the JBoss repository

How to connect to the internal maven repository?

In our company we have an internal maven repository. The IDE used is eclipse.
The link to the internal maven repository is http://machinename:8080/artifactory
Can someone please help me how to connect to this internal maven repository and also what all changes are to be made on the eclipse to use this?
You need to update your Maven settings.xml file to use the internal Artifactory repo, instead of the global maven repository.
In Eclipse go to Window > Preferences > Maven > User Settings and edit the settings.xml file to contain your repository. e.g.
<profile>
<id>profile_name_here</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>profile_id_here</id>
<name>artifactory</name>
<url>http://machinename:8080/artifactory</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
</repositories>
</profile>