WSO2 BAM 2.0 libraries in Maven - maven

I'm trying to replicate the KPIAgent example in the WSO2 BAM ALPHA2 release but using maven to get the libraries required for the project to run.
So I've defined the following dependencies:
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.bam.agent</artifactId>
<version>3.2.4</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.bam.data.publisher.util</artifactId>
<version>3.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.bam.service</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.google.common.wso2</groupId>
<artifactId>google-collect</artifactId>
<version>1.0.0.wso2v2</version>
</dependency>
<dependency>
<groupId>libthrift.wso2</groupId>
<artifactId>libthrift</artifactId>
<version>0.5.wso2v1</version>
</dependency>
<dependency>
<groupId>commons-pool.wso2</groupId>
<artifactId>commons-pool</artifactId>
<version>1.5.0.wso2v1</version>
</dependency>
Along with them I've defined the WSO2 repository this way:
<repository>
<id>wso2-maven2-repository</id>
<name>WSO2 Maven2 Repository</name>
<url>http://dist.wso2.org/maven2</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>
The problem I have is that the remote pom file for http://dist.wso2.org/maven2/org/wso2/carbon/org.wso2.carbon.bam.agent/3.2.4/org.wso2.carbon.bam.agent-3.2.4.pom refers to
<parent>
<groupId>org.wso2.carbon</groupId>
<artifactId>data-agents</artifactId>
<version>3.2.4</version>
</parent>
Which doesn't exist.
I assume this happens due to a rearrangement of the component's sources which is not fully reflected in the repository just yet; thus causing this inconsistency.
Question is then, which set of dependencies should I use to use EventReceiver in order to publish my own Events?
Thanks in advance for your support.

Seems it is not in the repo as you have mentioned for some reason. Can you try installing the pom given below to your local repository and see whether it works.
http://pastebin.com/AcmR1xmW

Related

How do you import com.mojang.authlib [Maven]

I am making a plugin with custom skin textures and I need to use GameProfile which is Mojang authlib. I put it in my pom.xml but it says it cannot find the dependency Dependency 'com.mojang:authlib:1.5.21' not found . Here is my full pom.xml:
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.5.21</version>
<scope>provided</scope>
</dependency>
</dependencies>
Try using the paperspigot repository it provides mojang authlib from 1.5 to 3.4.40.
<repository>
<id>paper-repo</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
Reference: https://papermc.io/using-the-api

maven - anypoint studio fails to load a maven module inside a mule project

I've created a custom Mule extension, and I wanted to test it by loading it into a mule demo project as a mule-plugin.
I'm using Anypoint Studio 7.9.0, I have Maven 3.6.3 installed.
I run mvn clean package to create the .jar of my custom mule extension, and then mvn clean install to install it into my local Maven repository.
When I go to {mule demo project} -> Manage Dependencies -> Manage Modules -> Add module from Maven and try to add my custom mule extension to the mule demo project in which I want to test it, I get this error: Failed to resolve module {groupID}:{module name}
Frankly, I'm stuck here for some time now, and cannot figure out what I'm missing.
Here's the pom.xml of my custom mule extension:
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>custom-mule-extension</artifactId>
<version>0.1.1</version>
<packaging>mule-extension</packaging>
<name>Custom Mule Extension</name>
<parent>
<groupId>org.mule.extensions</groupId>
<artifactId>mule-modules-parent</artifactId>
<version>1.1.3</version>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.5</version>
</dependency>
</dependencies>
And this is the pom.xml of my mule demo application:
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>elastic-demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>
<name>elastic-demo</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<app.runtime>4.3.0-20210322</app.runtime>
<mule.maven.plugin.version>3.5.1</mule.maven.plugin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>${mule.maven.plugin.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-sockets-connector</artifactId>
<version>1.2.2</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-http-connector</artifactId>
<version>1.5.25</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>custom-mule-extension</artifactId>
<version>0.1.1</version>
<classifier>mule-plugin</classifier>
</dependency>
</dependencies>
<repositories>
<repository>
<id>anypoint-exchange-v2</id>
<name>Anypoint Exchange</name>
<url>https://maven.anypoint.mulesoft.com/api/v2/maven</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<layout>default</layout>
<url>https://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
The custom-mule-extension <dependency> element is the one that cannot be resolved. As you can see from the snippet above, I inserted the dependency directly into the pom.xml file after the "Add modules" way from Anypoint Studio UI failed. And here, I get the error that the module cannot be resolved.
One thing that bothers me is: when I launch the mvn clean install -DskipTests command, there is one [INFO] log that doesn't look good, and it's the one saying No primary artifact to install, installing attached artifacts instead.
The build goes fine, and the dependency pops up into my local maven repository, but then I cannot add it to the mule demo project.
Any help or advice would be much appreciated.
Thanks in advance.

Maven spring-data-elasticsearch dependency Not Found

I have a spring boot app for which I want to use the dependency spring-data-elasticsearch. I'm using one of the latest version of Elasticsearch on my server (v5.4.x) so I had to use the latest snapshot of spring-data-elasticsearch (3.0.0.BUILD-SNAPSHOT).
According to the git page (link below) :
https://github.com/spring-projects/spring-data-elasticsearch/blob/master/README.md
I have to declare in my pom.xml a special repository where is located this specific version of the dependency, as you can see below :
<repositories>
<repository>
<id>spring-libs-snapshot</id>
<name>Spring Snapshot Repository</name>
<url>http://repo.spring.io/libs-snapshot</url>
</repository>
</repositories>
<dependencies>
<!-- ELK -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>3.0.0.BUILD-SNAPSHOT</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
But I have the following error on my pom.xml :
Missing artifact org.springframework.data:spring-data-elasticsearch:jar:3.0.0.BUILD-SNAPSHOT
Anyone knows where the problem is coming from please ? I'm pulling hairs out of my head since 2 hours.
Thank you !
You probably have to add the Spring snapshot repository to your pom.xml
<repositories>
<repository>
<id>repository.spring.snapshot</id>
<name>Spring Snapshot Repository</name>
<url>http://repo.spring.io/snapshot</url>
</repository>
</repositories>
Thanks for your replies but I'm feeling like a fool. In my company we work with a nexus where all the repos are deployed, so I had to add the informations about the repos in my nexus too.
Sorry for the inconvenience.

Apache Commons VFS Maven Repository?

Any idea on which Maven repository to use in order to use Apache commons VFS libraries?
Thanks.
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.1-SNAPSHOT</version>
</dependency>
** Edit ** : the following repository works fine:
<repository>
<id>commons-vfs</id>
<name>Apache Commons VFS Repository Group</name>
<url>https://repository.apache.org/content/groups/snapshots/</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
Please check that your artifactId is correct: http://mvnrepository.com/artifact/org.apache.commons/commons-vfs2/2.0
It should be:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.0</version>
</dependency>
If you need version 2.1-SNAPSHOT you can use this Maven repository:
http://repository.jboss.org/
Version 2.1-SNAPSHOT implements some new features.

Maven pom error

I have example projects from spring core training courses I've been on. They did work on their machines, not on mine though. I am not really expert with maven, but .pom file inside gives this error. I really appreciate any monkey-alike-instructions, I'l do first then understand. Thank you very much in advance. I just want to run them and go through again.
Project build error: Non-resolvable parent POM: Failure to transfer com.springsource.training.common:abstractWebProject:pom:1.1.7.RELEASE from https://tbits.springsource.com/repository/snapshot was cached in the local repository, resolution will not be reattempted until the update interval of com.springsource.training.snapshot has elapsed or updates are forced.
Original error: Could not transfer artifact com.springsource.training.common:abstractWebProject:pom:1.1.7.RELEASE from/to com.springsource.training.snapshot (https://tbits.springsource.com/repository/snapshot): ConnectException and 'parent.relativePath' points at wrong local POM pom.xml /mvc-1-solution line 1 Maven Problem
plus I am having numerous mistakes for missing libraries:
Description Resource Path Location Type
Project 'mvc-1-solution' is missing required library: 'C:\Users\Blabla\.m2\repository\org\cloudfoundry\cloudfoundry-runtime\0.6.0-BUILD-SNAPSHOT\cloudfoundry-runtime-0.6.0-BUILD-SNAPSHOT.jar' mvc-1-solution Build path Build Path Problem
Project 'mvc-1-solution' is missing required library: 'C:\Users\Blabla\.m2\repository\org\hibernate\hibernate-annotations\3.5.3-Final\hibernate-annotations-3.5.3-Final.jar' mvc-1-solution Build path Build Path Problem
Project 'mvc-1-solution' is missing required library: 'C:\Users\Blabla\.m2\repository\org\hibernate\hibernate-core\3.5.3-Final\hibernate-core-3.5.3-Final.jar' mvc-1-solution Build path Build Path Problem
and many more alike.
Their .pom file.
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.springsource.training.module</groupId>
<artifactId>mvc-1-solution</artifactId>
<packaging>war</packaging>
<version>3.2.1.RELEASE</version>
<parent>
<groupId>com.springsource.training.common</groupId>
<artifactId>abstractWebProject</artifactId>
<version>1.1.7.RELEASE</version>
</parent>
<repositories>
<repository>
<id>com.springsource.training.snapshot</id>
<name>SpringSource Training Repository - Snapshots</name>
<url>https://tbits.springsource.com/repository/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>com.springsource.training.release</id>
<name>SpringSource Training Repository - Releases</name>
<url>https://tbits.springsource.com/repository/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>org.springframework.maven.milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>springsource-snapshot</id>
<url>http://s3.amazonaws.com/private.maven.springsource.com/snapshot/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<!-- DBCP -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</exclusion>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
</exclusion>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.5.4</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- CloudFoundry -->
<dependency>
<groupId>org.cloudfoundry</groupId>
<artifactId>cloudfoundry-runtime</artifactId>
<version>0.6.0-BUILD-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Not a solution, but a recipe how to solve it:
Check each of the repositories you have defined in the Maven POM. For me, the 2 springsource repos are not available at the moment.
I think that the abstractWebProject will be contained in some of these. So the error Project build error: Non-resolvable parent POM: Failure to transfer will be a result of that.
After you may have access to the parent POM, you should check if all the dependencies are resolvable.
If everything fails, get in touch with the training team. If you were on that training, they will try to help you. You should have then the following information ready available:
The POM you want to use (as in your question)
The file settings.xml in your Maven installation
The version of your Maven isntallation
The file settings.xml in your user directory .m2 (depending on your operating system at different locations).
Hope you can get the help you need to solve it.
"..resolution will not be reattempted until the update interval of com.springsource.training.snapshot has elapsed or updates are forced." --This is due to the first failure trying to download artifacts, need to remove those *.lastUpdated from your repository.
For windows:
cd %userprofile%.m2\repository
for /r %i in (*.lastUpdated) do del %i

Resources