Maven won't deploy on Sonatype Nexus Repository - apache

[Links are replaced with [http] because StackOverflow does not allow more than 2 links for me...]
I have installed Apache Maven 3.2.3 ([http]maven.apache.org/download.cgi?Preferred=ftp://mirror.reverse.net/pub/apache/), and it has downloaded all core plugins.
Then I installed Sonatype Nenus OSS ([http]www.sonatype.org/nexus/go/) as a WAR application on my XAMPP tomcat server.
Everything is well set and works.
My unique goal here is to test a deployment of a file from my local Maven to my Nexus repository.
Here is my POM file project:
<project xmlns="..."
xmlns:xsi="..."
xsi:schemaLocation="...">
<modelVersion>4.0.0</modelVersion>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<version>1.0.0</version>
<distributionManagement>
<repository>
<id>releases</id>
<url>[http]localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
And here is my Maven configuration file: settings.xml
<settings xmlns="..."
xmlns:xsi="..."
xsi:schemaLocation="...">
<servers>
<server>
<id>releases</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
The account provided is the default one and it works from the Nexus GUI.
My Nexus repository "releases" is configured as following:
[http]i.stack.imgur.com/Nh3dO.png
And when i use the following command:
mvn deploy
Or the following:
mvn deploy:deploy
Which are almost the same as far as I'm concerned...
Maven tells me this:
[http]i.stack.imgur.com/2vBNx.png
And the [Help 1] tells nothing but "see the plugin documentation". And the error message tells me that "The repository element is not specified in the POM file", but it actually is...
I really don't see what i am missing :/
Thanks for your help

Thank you all for your answers. I don't really have an idea why it works, but using these files works:
ArtifactA POM file:
<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>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<version>1.2.4</version>
<dependencyManagement>
<dependencies>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Test Repository</name>
<url>http://localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
ArtifactB POM file:
<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>
<groupId>groupA</groupId>
<artifactId>artifactB</artifactId>
<version>1.0.0</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<version>1.2.4</version>
<type>zip</type>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Test Repository</name>
<url>http://localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
Maven settings file:
<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">
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<name>Nexus Test Repository</name>
<url>http://localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
<mirrorOf>*,!central</mirrorOf>
</mirror>
</mirrors>
</settings>
Deployment script:
mvn deploy:deploy-file \
-Dfile=artifactA_package.zip \
-Dpackaging=zip \
-DpomFile=pomA1.2.4.xml \
-Durl=http://localhost:8080/nexus-2.9.2-01/content/repositories/releases \
-DrepositoryId=nexus
mvn deploy:deploy-file \
-Dfile=artifactB_package.zip \
-Dpackaging=zip \
-DpomFile=pomB1.0.0.xml \
-Durl=http://localhost:8080/nexus-2.9.2-01/content/repositories/releases \
-DrepositoryId=nexus
Hope it will help the next one :)

I use wagon-webdav-jackrabbit pluging in combination with something like your configurations. It enables Maven to deploy artifacts and files to WebDAV enabled servers.
http://maven.apache.org/wagon/wagon-providers/wagon-webdav-jackrabbit/
Paste this in your pom.xml
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>2.4</version>
</extension>
</extensions>
</build>

Related

Migrating from Apache Ignite to GridGain Community Edition

Currently, We are using Apache Ignite version 2.8.1. We want to migrate to GridGain Community Edition: 8.7.32
Wanted to know GridGain version: 8.7.32 is compatible with which Apache Ignite Version.
Also, we are using the below dependencies in Ignite
ignite-core
ignite-spring
ignite-visor-console
What're the equivalent dependencies in GridGain?
You can use the following Maven pom.xml skeleton as a reference:
<?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">
...
<properties>
<gridgain.version>8.7.32</gridgain.version>
</properties>
<repositories>
<repository>
<id>GridGain External Repository</id>
<url>http://www.gridgainsystems.com/nexus/content/repositories/external</url>
</repository>
</repositories>
<dependencies>
<!-- GG CE / Apache Ignite -->
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-core</artifactId>
<version>${gridgain.version}</version>
</dependency>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-indexing</artifactId>
<version>${gridgain.version}</version>
</dependency>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-visor-console</artifactId>
<version>${gridgain.version}</version>
</dependency>
...
</dependencies>
</project>
With regards of versions, 8.7.32 should be on par with Apache Ignite 2.9.1 feature-wise.

Oracle jdbc jar unable to down load in maven plugin

[WARNING] The POM for com.oracle:ojdbc7:jar:12.1.0 is missing, no dependency information available
<!-- Oracle JDBC driver -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0</version>
</dependency>
<!-- HikariCP connection pool -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.6.0</version>
</dependency>
The latest release of the oracle jdbc driver is available in maven central since a few days (september 2019, announced at Oracle CodeOne), there is no longer a need to install it locally or add obscure other repositories.
See https://medium.com/oracledevs/oracle-jdbc-drivers-on-maven-central-64fcf724d8b
The coordinates are
<!-- https://mvnrepository.com/artifact/com.oracle.ojdbc/ojdbc8 -->
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
ojdbc7 is absent in the maven central repository
You need to download jar from oracle.com.
Currently it can be downloaded here. Registration is needed.
https://www.oracle.com/database/technologies/jdbc-upc-downloads.html
Then import ojdbc7.jar into your local maven repository with the following command
mvn install:install-file -Dfile=ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.2 -Dpackaging=jar -DgeneratePom=true
Alternatively, if your team has it's own remote maven repository, import it there.
edit: fixed mvn command and link
Add repository to your build and download:
See on mvnrepository.com
<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>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>HandChina-RDC</id>
<name>HandChina RDC</name>
<url>http://nexus.saas.hand-china.com/content/repositories/rdc/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
</dependencies>
</project>

How to resolve project library via own mvn repository (artifactory)

How can I link an maven repository that we set up internally with my Intellij?
In the project libraries view, I am able to add a new project library that resides in the standard maven reppositories but I do not see how to point IntelliJ to a specifiy maven repository, for example the artifactory that we set up for the company.
Settings.xml is also not recognized by Intellij. I post the settings.xml afterwards, it's not recognized though (password, username and company name have been replaced) :
<settings>
<servers>
<server>
<username>USER</username>
<password>PW</password>
<id>central</id>
</server>
</servers>
<mirrors>
<mirror>
<mirrorOf>*</mirrorOf>
<url>
https://dev.mycompany.com:8443/artifactory/any
</url>
<id>central</id>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<snapshots />
<id>central</id>
<url>
https://dev.mycompany.com:8443/artifactory/libs
</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots />
<id>central</id>
<url>
https://dev.mycompany.com:8443/artifactory/plugins
</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
IntelliJ uses repositories from pom.xml for your maven project and settings.xml, your maven configuration file. In order to get dependencies from repote repository and by not adding pom.xml, I believe you should define repository in settings file.
By default, this file is located in your home folder like {home}/.m2/settings.xml
Try add this configuration:
<settings>
...
<profiles>
...
<profile>
<id>myprofile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>my-repo2</id>
<name>your custom repo</name>
<url>http://jarsm2.dyndns.dk</url>
</repository>
</repositories>
</profile>
...
</profiles>
<activeProfiles>
<activeProfile>myprofile</activeProfile>
</activeProfiles>
...
</settings>
Also remember that you should either use profile while using maven or make it active by default. See more information here

MuleStudio Connector Example The attribute comments is undefined for the annotation type Generated

I'm getting the following error after importing the project from Maven POM to MuleStudio.
The attribute comments is undefined for the annotation type Generated
Please help to resolve this issue.
My 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hello</groupId>
<artifactId>hello-connector</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>mule-module</packaging>
<name>Hello Connector</name>
<parent>
<groupId>org.mule.tools.devkit</groupId>
<artifactId>mule-devkit-parent</artifactId>
<version>3.4.3</version>
</parent>
<properties>
<junit.version>4.9</junit.version>
<mockito.version>1.8.2</mockito.version>
<jdk.version>1.6</jdk.version>
<category>Community</category>
<licensePath>LICENSE.md</licensePath>
<devkit.studio.package.skip>false</devkit.studio.package.skip>
</properties>
<scm>
<connection>scm:git:git://github.com:mulesoft/hello-connector.git</connection>
<developerConnection>scm:git:git#github.com:mulesoft/hello-connector.git</developerConnection>
<url>http://github.com/mulesoft/hello-connector</url>
</scm>
<repositories>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshots Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>common</artifactId>
<version>3.3.0-v20070426</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
I had the same problem. I used mule-devkit-partent version 3.4.2 to make it work.

Maven: compiling with all dependencies in one Jar

in pom of a project, i have added dependency with scope compile . which is a jar file which contains some class file and jar's as well. my current java file needs internal jars of dependent jar to compile.
But maven compile goal returning compilation error . :banghead:
All the jar's needed to compile are in the single jar file which is added in dependency.............................
Please help me!
my pom:
<project>
<!-- ... -->
<dependencies>
<dependency>
<groupId>eagle</groupId>
<artifactId>zkui</artifactId>
<version>360LTS</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>./src/main/java</sourceDirectory>
<outputDirectory>./target/classes</outputDirectory>
<finalName>${project.groupId}-${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
error:
package org.zkoss.zk.ui does not exist
this package org.zkoss.zk.ui is in jar
file zkex.jar which is in dependency
jar eagle:zkui:360LTS jar file
Please Help ME!!!! :jumpingjoy:
Advance Thanks
Well I guess you could
use dependency:unpack to unpack the jars to target/lib or so (before compile)
deactivate compiler:compile by excluding everything
<excludes>
<exclude>**/*.java</exclude>
</exclude>
use antrun:run with the ant javac task to compile the sources, something like this (bind the execution to phase compile):
<target>
<javac srcdir="${project.build.sourceDirectory}"
destdir="${project.build.outputDirectory}">
<classpath>
<pathelement path="${maven.compile.classpath}"/>
<fileset dir="${project.build.directory}/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
</target>
However, while that would help you compile your application, it would not help you run or deploy your application.
You can use the element to do this:
<dependencies>
<dependency>
<groupId>groep.does.not.matter</groupId>
<artifactId>neither-does-artifactId</artifactId>
<version>and.nor-does-version</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${project.baseDir}/lib/jarname.jar</systemPath>
</dependency>
</dependencies>
where the jar you need to reference (and have in your classpath) is lib/jarname.jar, and the lib directory is in the root of your project.
I believe you're actually not using the proper dependencies. ZK actually have Maven repositories as described here.
You need to check which dependencies you need. For example for zkex, you would need something like:
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkex</artifactId>
<version>${zk.version}</version>
</dependency>
You will also need to add the ZK Maven repositories:
<repositories>
<repository>
<id>zk repository</id>
<url>http://mavensync.zkoss.org/maven2</url>
</repository>
<!-- If Using ZK EE or ZK PE Respository (not evaluation version), you need to add login info into ~/.m2/settings.xml -->
<repository>
<id>ZK PE Evaluation</id>
<url>http://mavensync.zkoss.org/zk/pe-eval</url>
</repository>
<repository>
<id>ZK EE Evaluation</id>
<url>http://mavensync.zkoss.org/zk/ee-eval</url>
</repository>
</repositories>
Good luck! :-)