Non-resolvable parent POM - maven

I am trying to develop a custom connector for mule by following http://www.mulesoft.org/documentation/display/current/Creating+a+Connector+Project tutorial.
As shown in the tutorial, I am creating the project through command line by executing
mvn archetype:generate
-DarchetypeGroupId=org.mule.tools.devkit
-DarchetypeArtifactId=mule-devkit-archetype-cloud-connector
-DarchetypeVersion=3.4.3
-DgroupId=org.hello
-DartifactId=hello-connector
-Dversion=1.0-SNAPSHOT
-DmuleConnectorName=Hello
-Dpackage=org.hello
-DarchetypeRepository=http://repository.mulesoft.org/releases
After importing the project to mule studio I am getting following error in my pom.xml file near the parent tag.
Project build error: Non-resolvable parent POM:
Could not transfer artifact
org.mule.tools.devkit:mule-devkit-parent:pom:3.4.3 from/to
mulesoft-releases (http://repository.mulesoft.org/releases/):
connection timed out to
http://repository.mulesoft.org/releases/org/mule/tools/devkit/mule-devkit-parent/3.4.3/mule-devkit-parent-3.4.3.pom
and 'parent.relativePath' points at wrong local POM.
Here is my pom.xml 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.7</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>
</project>
I have changed the jdk version to 1.7. it was 1.6 in the auto generated pom.
ignore any error in the heading, some formatting issue.
I have tried various solutions mentioned on here but am not able to resolve the issue.

There is probably a firewall between your computer and the internet. You either have to configure Java to use this proxy.
Or you must download the parent POM manually and install it yourself into the local m2 repo. See this question how to do that: How to manually install an artifact in Maven 2?
Since you only need to install a POM, you need to trick mvn install:install-file:
mvn install:install-file -Dfile=<path-to-pomfile> -Dpackaging=pom -DpomFile=<path-to-pomfile>
This command will just install the POM itself.

Related

POM for my own repo is missing, no dependency information available

I am currently learning software development and working on an assignment based on using a release from one project in another using jitpack.
The first project, which I want to add as a dependency in my second, simply has three classes and a JUnit test for each. I changed several things so I am at V5.0 release now.
https://github.com/MohamedMoustafaNUIG/assignment1/releases/tag/V5.0
My second project is not yet pushed, but this is the 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>com.nuig</groupId>
<artifactId>assignment1_driver</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.github.MohamedMoustafaNUIG</groupId>
<artifactId>assignment1</artifactId>
<version>v5.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
</project>
When I try to build with dependencies (in netbeans), I get this error:
Failed to execute goal on project assignment1_driver:
Could not resolve dependencies for project com.nuig:assignment1_driver:jar:1.0-SNAPSHOT:
Failure to find com.github.MohamedMoustafaNUIG:assignment1:jar:v5.0 in
https://jitpack.io was cached in the local repository,
resolution will not be reattempted until the update interval of jitpack.io has
elapsed or updates are forced -> [Help 1]
I also get this warning:
The POM for com.github.MohamedMoustafaNUIG:assignment1:jar:v5.0 is missing, no dependency information available
Even though the zip file (from linked release) has the pom file.
Any help appreciated as I have no idea how to resolve this the issue
You either need to:
build assignment1 on the same machine with clean install to make it available in the local repository.
deploy assignment1 to a Maven repository with clean deploy and then use this as a <repository>.

Why my maven project does not pick-up the jar from nexus

I am on Redhat, using jenkins with Nexus Repository Manager OSS 2.12.0-01.
What I am trying to achieve is to download all the jar from nexus.
What, I have accomplished.
Successfully installed nexus 2.12.0-01
This is the content of my maven setting.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">
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
Successfully installed 3rd party jar for Ojdbc5 in nexus
content of my parent pom
<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.abc</groupId>
<artifactId>Test</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Maven Webapp</name>
<url>http://maven.apache.org</url>
<modules>
<module>Project1</module>
<module>Project2</module>
</modules>
<distributionManagement>
<snapshotRepository>
<id>my-snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>my-releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
In the above pom.xml there are two projects define. When I build using jenkins, The first project get successfully build. but the second one throws error.
Failed to execute goal on project project2: Could not resolve
dependencies for project com.abc:project2:war:0.0.1-SNAPSHOT: Failure
to find com.oracle:ojdbc5:jar:11.2.0.1 in
http://localhost:8081/nexus/content/groups/public was cached in the
local repository, resolution will not be reattempted until the update
interval of nexus has elapsed or updates are forced -> [Help 1]
Please see the project2 pom.xml
<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.abc</groupId>
<artifactId>project2</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Maven Webapp</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
<distributionManagement>
<repository>
<id>thirdparty</id>
<url>http://localhost:8081/nexus/content/repositories/thirdparty</url>
</repository>
</distributionManagement>
<dependencies>
<!-- Spring ORM support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.2.13.RELEASE</version>
</dependency>
<!-- Spring Batch -->
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>3.0.1.RELEASE</version>
</dependency>
<!-- ojdbc 5 dependency provide by nexus-->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc5</artifactId>
<version>11.2.0.1</version>
</dependency>
<!-- That is creating problem -->
Please do not worry about the above pom.xml I have removed lot of dependency from pom to reduce the size of question. The pom structure is Ok.
Now coming to question. Have I missed any configuration, Why I am getting
Failed to execute goal on project gsdataprocessor: Could not resolve dependencies for project com.globalss.batch:gsdataprocessor:war:0.0.1-SNAPSHOT: Failure to find com.oracle:ojdbc5:jar:11.2.0.1 in http://localhost:8081/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
This error.
Please help
Update 1: As suggest by user sanigo I have added Thirdpary repository the Public Repository Group
Update 2: Below is the screen-short which shows oracle ojdbc5 is available is public repository.
Your http://localhost:8081/nexus/content/groups/public (Public Repository Group) is mirror of "*", so you should add http://localhost:8081/nexus/content/repositories/thirdparty(Thirdparty repositoy) to the Public Repository Group, you can do this in the Public Repository Configuration tab. Then you can use mvn -U clean install.

Download jar from maven repository without using Maven

I am looking for a library that can help me with K-means Vector Quantization. I found a website that offered hope.
http://www.lab4inf.fh-muenster.de/lab4inf/Lab4Drools/dependencies.html
The Lab4Math-1.0.5.jar has the required KmeansQuantization class.
But as see you from the first link, there is no direct download link for the "Lab4Math-1.0.5.jar".
Instead a maven repository is specified.
http://www.lab4inf.fh-muenster.de/lab4inf/maven-repository
Since iam a mobile app developer, i dont use Maven. I am looking for a way to download the jar in any other way. Please help.
Looks like there is a problem with the repository:
[ERROR] Failed to execute goal on project demo: Could not resolve dependencies for project com.demo:demo:jar:1.0-SNAPSHOT:
Failed to collect dependencies for [de.lab4inf:Lab4Math:jar:1.0.5 (compile)]:
Failed to read artifact descriptor for de.lab4inf:Lab4Math:jar:1.0.5:
Could not transfer artifact de.lab4inf:Lab4Math:pom:1.0.5 from/to
Lab4Inf (http://www.lab4inf.fh-muenster.de/lab4inf/maven-repository):
Access denied to: http://www.lab4inf.fh-muenster.de/lab4inf/maven-repository/de/lab4inf/Lab4Math/1.0.5/Lab4Math-1.0.5.pom ,
ReasonPhrase:Forbidden. -> [Help 1]
Tried to retrieve the module metadata file and got a HTTP 403 error....
I was trying to follow the instructions for integrating Math4Lab and discovered it's out of date. Maven 3 forces the specification of a dependency version number and there is a little note at the bottom:
... This way you will have always the newest versions, if snapshots are enabled. At present no final Lab4Math version is available.
My conclusion is that this software is abandonware...
Example
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo</groupId>
<artifactId>demo</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>de.lab4inf</groupId>
<artifactId>Lab4Math</artifactId>
<version>1.0.5</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Lab4Inf</id>
<url>http://www.lab4inf.fh-muenster.de/lab4inf/maven-repository</url>
</repository>
</repositories>
</project>
I was able to download the mentioned jar using the following pom.xml
<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.demo</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tf</name>
<description>Testing Lab4Math</description>
<repositories>
<repository>
<id>Lab4Inf</id>
<url>http://www.lab4inf.fh-muenster.de/lab4inf/maven-repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>de.lab4inf</groupId>
<artifactId>Lab4Math</artifactId>
<version>2.0.5-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Note that the only important difference with the accepted answer is the version of the library. (2.0.5-SNAPSHOT instead of 1.0.5)

maven deploy: how to restrict to deploy only the artifacts? (multi-module environment)

I have a project with two modules: client and server. In the parent pom.xml I added info for the deployment phase, so as to deploy to a local directory:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.my</groupId>
<artifactId>myTest</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<name>myTest</name>
<modules>
<module>server</module>
<module>client</module>
</modules>
<!-- for: mvn deploy -->
<distributionManagement>
<repository>
<id> myRepo </id>
<url> file:myDeployDir </url>
</repository>
</distributionManagement>
</project>
When I run mvn deploy not only server-0.1.jar and client-0.1.jar get copied to myDeploy but a sum of 33 (!) files: *pom *sha1 *md5 *xml for pom, metadata and jar.
How can I set that only server-0.1.jar and client-0.1.jar should be copied?
Thanks!
Use maven deploy-file
deploy:deploy-file is used to install a single artifact along with its
pom. In that case the artifact information can be taken from an
optionally specified pomFile, but can be completed/overriden using the
command line.

Adding a maven (distribution) repository on the command line

I think this should be possible, but I have not found anything related to it, as all I have found relates to dependency repositories.
What I would like to do is define the repository where maven (deploy, or release plugin for example) pushes the artifacts. How can I define it on the command line? I assume it is -Dsomething
UPDATE: When I read a jenkins error output carefully, it hints about using:
-DaltDeploymentRepository=id::layout::url
What Is the format for using this? What is the layout parameter?
The simplest thing is to read the documentation about the maven-deploy-plugin which describes the format:
mvn -DaltDeploymentRepository=repositoryId::default::http://WhatEverURL
In the distributionManagement you usually give things like:
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>MyCo Internal Repository</name>
<url>Host to Company Repository</url>
</repository>
</distributionManagement>
If you like to use a different URL in this case you need to give:
mvn -DaltDeploymentRepository=internal.repo::default::http://WhatEverURL
The default in this case is the default for the maven repository layout.
In your pom.xml you should add distributionManagement configuration to where to deploy.
In the following example I have used file system as the locations.
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
.........
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Internal repo</name>
<url>file:///home/thara/testesb/in</url>
</repository>
</distributionManagement>
............
</project>
The same thing can be done by following command:
mvn deploy -DaltDeploymentRepository=internal.repo::default::file:///home/thara/testesb/in

Resources