Why Artifactory Maven and Oracle fail to communicate? - oracle

I hope an answer will be a universal guide on how to connect Maven, Oracle And Artifactory and will become most usefull webpage on the net. Most likely this question will be marked down, but I just give up on Maven, Artifactory and Oracle.
I am running windows 7-64 with maven installed as a part of Oracle jdev. Company has Artifactory setted up and running on vpn network.... but somethings are not right.
Following simple instructions on:
http://biemond.blogspot.co.uk/2013/07/maven-support-in-weblogic-jdeveloper.html
fails at first instruction:
Install the oracle maven sync plugin to your local repository
the command:
mvn deploy:deploy-file -DpomFile=oracle-maven-sync.12.1.2.pom -Dfile=oracle-maven-sync.12.1.2.jar
the error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file are missing or invalid -> [Help 1]
adding
-Durl=file://C:\Users\{user}\.m2
seems to install that artifact to my local .m2 repo
C:\Users\{user}\.m2\com\oracle\maven\oracle-maven-sync\12.1.2-0-0
but only seems, then I get to number 3 on that tutorial:
mvn com.oracle.maven:oracle-maven-sync:help
gives an error:
[ERROR] Error resolving version for plugin 'com.oracle.maven:oracle-maven-sync' from the repositories [local (C:\Users\{user}\.m2), central (http://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]
So the plugin failed to install?
Oracle Maven repository is password protected due to weird oracle thoughts, Artifactory has external Central and Oracle repositories why letting it mirror everything stops maven from even finding deploy module?
here is my settings.xml:
<?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>user</username>
<password>xxx</password>
<id>central</id>
</server>
<server>
<username>user</username>
<password>xxx</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release-local</name>
<url>http://art.host.ru:8081/artifactory/libs-release-local</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot-local</name>
<url>http://art.host.ru:8081/artifactory/libs-snapshot-local</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release-local</name>
<url>http://art.host.ru:8081/artifactory/plugins-release-local</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot-local</name>
<url>http://art.host.ru:8081/artifactory/plugins-snapshot-local</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
<profile>
<id>oracle-maven</id>
<properties>
<oracle-maven-sync.oracleHome>C:\Oracle\Middleware\Oracle_Home</oracle-maven-sync.oracleHome>
<oracle-maven-sync.testOnly>false</oracle-maven-sync.testOnly>
<oracle-maven-sync.failOnError>false</oracle-maven-sync.failOnError>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>oracle-maven</activeProfile>
</activeProfiles>
</settings>

Well, I think you just follow the wrong guide. All this manual deployment of some random maven plugins is just wrong.
Just follow the simple and detailed instructions in the Artifactory User Guide and you're good to go.

The problem is with the -Dmaven.repo.local
Do not provide the argument.

Use http://jcenter.bintray.com for most of the artifacts
And for Oracle: oracle-maven-sync plugin
oracle instructions
$ORACLE_HOME = where jdev 12.1.2
$M2_HOME = $ORACLE_HOME/oracle_common/modules/org.apache.maven_3.0.4
$M2 = $M2_HOME/bin (add to $PATH)
artifactory->home->maven settings generate settings.xml put it in ~/.m2
create local repo in artifactory"oracle-local-12.1.2"
settings.xml add following code
<profiles>
<profile>
<properties>
<oracle-maven-sync.oracleHome>$ORACLE_HOME</oracle-maven-sync.oracleHome>
<oracle-maven-sync.testOnly>false</oracle-maven-sync.testOnly>
<oracle-maven-sync.failOnError>false</oracle-maven-sync.failOnError>
<oracle-maven-sync.serverId>oracle-local-12.1.2</oracle-maven-sync.serverId></properties>
artifactory -> username(top right corner) -> enter pass -> unlock -> забрать encrypted password(copy)
add aquired pass to settings.xml for all
go to $ORACLE_HOME/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.2 (use cmd/terminal)
mvn deploy:deploy-file -DpomFile=oracle-maven-sync-12.1.2.pom -Dfile=oracle-maven-sync-12.1.2.jar
test it: mvn com.oracle.maven:oracle-maven-sync:help
push artifacts oracle 12.1.2 mvn com.oracle.maven:oracle-maven-sync:push
long time wait (~3000 artifacts > 2 hours)
complete set up of repos and in settings.xml

Related

Mule XML SDK and its Error in Maven Settings.xml

I'm doing the XML SDK in Mule 4.2.2 with Maven 3.6.3 [though Mule inbuild using (3.6.9)] and AnypointStudio 7.4.2 . Please clarify my doubts
1) Is that XML SDK connectorPlugin creation is supported only in Mule-EE version or public?
2) I'm using the below Maven command and settings.xml , which is throwing 401 Unauthorized (Warning) and error as 'Archetype' issue.
mvn archetype:generate -DarchetypeGroupId=org.mule.extensions -DarchetypeArtifactId=xml-mule-extensions-archetype -DarchetypeVersion=1.0.1 -DgroupId=org.mule.extension -DartifactId=error-handler-framework -DmuleConnectorName=ErrorHandler
Error I'm getting as below. But i can able to assess this URL https://repository.mulesoft.org/releases/ without Login. Not sure why its throwing 401
[WARNING] Failure to transfer org.mule.tools/maven-metadata.xml from
https://repository.mulesoft.org/releases/ was cached in the local repository, resolution will not be reattempted until the update interval of mulesoft-releases has elapsed or updates are forced. Original error: Could not transfer metadata org.mule.tools/maven-metadata.xml from/to mulesoft-releases (https://repository.mulesoft.org/releases/): authenticationrequired (401)
[ERROR] No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.mule.tools, org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\jxsubr\.m2\repository), mulesoft-releases (https://repository.mulesoft.org/releases/), central (https://repo.maven.apache.org/maven2)]
Below is the settings.xml
<?xml version="1.0"?>
<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">
<localRepository>C:\Users\star\.m2\repository</localRepository>
<profiles>
<profile>
<id>Mule</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
<profile>
<id>standard-repositories</id>
<repositories>
<repository>
<id>Central</id>
<name>Central</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-ee-release</id>
<url>https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
..............
</profile>
I also tried giving Public Repo, instead Mule-ee in the above settings. Still the same error. Please direct me a standard settings.xml for Mule if any.
3) Though Mule inbuild for this runtime 4.2.2 using Maven 3.6.9. Can we use lower version 3.6.3 (I believe this is the stable version now)?
Reference: https://docs.mulesoft.com/mule-sdk/1.1/xml-sdk
Thanks in advance for your help. Please let me know if needed more information.
I think you need to declare the repos as pluginRepositories too for the archetype to work. HTH
This dependency is available only for MuleSoft Enterprise Maven customer repository only.
IN XML SDK other than transform message this ee xsd may not require., I have created a log forwarder without using this dependency.
Log Forwarding Connector Mule XML-SDK - DZone
https://dzone.com/articles/mule-log-forwarder-connector-xml-sdk
https://docs.mulesoft.com/mule-runtime/3.6/configuring-maven-to-work-with-mule-esb#%C2%A0referencing-mulesoft-s-enterprise-repositories.

How to connect local archiva repository and create maven project in Eclipse?

I have no internet access on my project and trying to deploy archiva and use it to create maven projects offline.
So, i downloaded apache archiva and deployed it on my local computer.
Then i created local repository with this settings.
Then i changed settings.xml in maven folder
<?xml version="1.0" encoding="UTF-8"?>
<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">
<localRepository>C:/MavenRepository/.m2/repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>local.repository</id>
<name>test repo</name>
<url>http://localhost:8888/archiva/repository/local.repository</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>local.repository</id>
<name>local.repository</name>
<url>http://localhost:8888/repository/local.repository/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>local.repository</id>
<name>local.repository</name>
<url>http://localhost:8888/repository/local.repository/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
and then tried to add archetype catalog in maven settings in eclipse but it saying remote catalog is empty
.
What i need to do to get correct archetypes to create maven project in eclipse?
You created a new Maven repository. It is empty. Then you defined it as mirror in your settings.xml. This means that all requests (including the one for archetypes) go to an empty repository.
The same will happen when you try to build anything with Maven. Maven will try to download tons of plugins, JARs, POMs etc. from the Maven repository and will fail.
You will need Internet connection somewhere. You can e.g. connect your archiva to MavenCentral, build your project and then shut down the connection. Or you can do this on another computer and copy the artifacts from one archiva to the other.
Before you create a maven project with Archiva or Nexus, you have make the following settings for Maven.
Go to Maven installation folder and open the file /conf/settings.xml, and add the following for Archiva.
<mirror>
<id>internal</id>
<name>Proxy Cache - Internal Repository</name>
<url>http://localhost:8080/archiva/repository/internal</url>
<mirrorOf>*</mirrorOf>
</mirror>
Configure eclipse with local maven setting. Go to preference in Eclipse, Preference > Maven > Installation and add the local maven setup for eclipse so that Eclipse will know about the local settings.
Then configure the user setting in eclipse with the local maven setting.xml. Go to Preference > Maven > User Settings and click on Browse button to select the /conf/settings.xml file from Maven installation folder.
Finally you can try to create a maven project or you import a Maven project.

Maven Unable to Find AEM Archetype

I've been starting at this problem for way to long... Im working through the Adobe wknd project and I can't get pass this command and most of the work is built off of it
mvn archetype:generate \
-DarchetypeGroupId=com.adobe.granite.archetypes \
-DarchetypeArtifactId=aem-project-archetype \
-DarchetypeVersion=18
I've tried it on the VPN and off, with all possible proxy configs and still getting the same error of
Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.0:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.adobe.granite.archetypes:aem-project-archetype:18)
Deleting and reinstalling multiple times. Different networks and proxy configs as well Mac OS.
mvn -v returns
Maven home: /Users/dmills/Applications/apache-maven-3.6.1
Java version: 1.8.0_212, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.5", arch: "x86_64", family: "mac"
Get this error
Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.0:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.adobe.granite.archetypes:aem-project-archetype:18)
Build is failing and I don't know where to go now
The error indicates that there is no Maven repository configured that contains the archetype you want to use. Default Maven installations are not aware of the Adobe repository which contains the archetype. You have to configure the repository.
Usually, you should use the following repository for your AEM projects:
http://repo.adobe.com/nexus/content/groups/public
This repository contains the archetype you want to use:
https://repo.adobe.com/nexus/content/groups/public/com/adobe/granite/archetypes/aem-project-archetype/18/
Based on the documentation (see Links below) this would be a minimal Maven settings.xml that would allow you to use the AEM Maven archetype:
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>adobe-public</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<releaseRepository-Id>adobe-public-releases</releaseRepository-Id>
<releaseRepository-Name>Adobe Public Releases</releaseRepository-Name>
<releaseRepository-URL>http://repo.adobe.com/nexus/content/groups/public</releaseRepository-URL>
</properties>
<repositories>
<repository>
<id>adobe-public-releases</id>
<name>Adobe Basel Public Repository</name>
<url>http://repo.adobe.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>adobe-public-releases</id>
<name>Adobe Basel Public Repository</name>
<url>http://repo.adobe.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
Note: I set activeByDefault to true for the adobe-public profile. This way you do not need to pass -Padobe-public on the command line to activate the profile.
Now, if you run the following command you should be able to use the archetype:
mvn archetype:generate \
-DarchetypeGroupId=com.adobe.granite.archetypes \
-DarchetypeArtifactId=aem-project-archetype \
-DarchetypeVersion=18
Links:
https://helpx.adobe.com/experience-manager/kb/SetUpTheAdobeMavenRepository.html
In the Adobe profile the 'settings' xml tag is missing:
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
.....
</profile>
</profiles>
</settings>
Just update the settings.xml file in the m2 folder. Please look into the below link if you are using archtype 13 and 6.4
https://helpx.adobe.com/experience-manager/using/maven_arch13.html
Also in the profile tag please update the adobe repo url to 'https' instead of http.

Order of maven repositories in settings.xml

I have a settings.xml which looks like 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">
<servers>
<server>
<id>nReleases</id>
<username>test</username>
<password>test123</password>
</server>
<server>
<id>nSnapshots</id>
<username>test</username>
<password>test123</password>
</server>
</servers>
<profiles>
<profile>
<id>space</id>
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>nReleases</id>
<name>Releases</name>
<url>http://someserver/repository/maven-releases/</url>
</repository>
<repository>
<id>nSnapshots</id>
<name>Snapshots</name>
<url>http://someserver/repository/maven-snapshots/</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>space</activeProfile>
</activeProfiles>
</settings>
I want maven to check repo1.maven.org first and then only look in someserver. Can someone let me know how this can be achieved?
I am using Maven 3.3.9.
I have gone through this question and tried to change the order in which repos are declared in profile but it did not help.
<profile>
<id>space</id>
<repositories>
<repository>
<id>nReleases</id>
<name>Releases</name>
<url>http://someserver/repository/maven-releases/</url>
</repository>
<repository>
<id>nSnapshots</id>
<name>Snapshots</name>
<url>http://someserver/repository/maven-snapshots/</url>
</repository>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
</profile>
Logs while doing mvn clean install
tuk-MacBook-Pro-4:camel tuk$ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building camel 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://someserver/repository/maven-releases/org/apache/camel/camel-redis/2.16.3/camel-redis-2.16.3.pom
Downloading: http://someserver/repository/maven-snapshots/org/apache/camel/camel-redis/2.16.3/camel-redis-2.16.3.pom
The order of the repository inside the settings was not clearly specified in Maven 2, but starting with Maven 3 (and the fix of of MNG-4400), the repositories are always tried in their declaration order in the settings.
What can happen, and what is likely the cause of your problem, is that Maven tries a repository, fails in doing so, and stores in your local repository the fact that it tried and failed. This results in the creation of .lastUpdated files in your local repository, storing this information. The consequence is that Maven will not re-try to download the dependency from a repository where it knows the download failed in the past. Thus, when you start a command and the project requires an artifact not present in your local repository, Maven will still try the repositories in their order of declaration, but it will skip the ones it knows already failed.
But you can force it to bypass this mechanism by passing the -U flag on the command line. It forces Maven to update the releases and snapshots dependencies, without looking into .lastUpdated files. This way, it will re-try every active remote repositories.

how is Maven 3 host look up different to Maven 2?

I am working to migrate from Maven 2 to Maven 3. I have purposely removed the host and port from the messages and settings.
Maven 2 currently works fine with the Artifactory central repository we have setup behind a firewall. When I switch to using Maven 3 it fails to download the plugins with the error message:
[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.3.1 or
one of its dependencies could not be resolved: Failed to read
artifact descriptor for org.
apache.maven.plugins:maven-install-plugin:jar:2.3.1: Could not
transfer artifact
org.apache.maven.plugins:maven-install-plugin:pom:2.3.1 from/to
central (http:/ /:/artifactory/plugins-release): Access
denied to:
http://:/artifactory/plugins-release/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom
, ReasonPhrase:Forbidden.
Here are my settings:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<proxies>
<proxy>
<id>andy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxyip</host>
<port>80</port>
<username>user</username>
<password>password</password>
<nonProxyHosts>host</nonProxyHosts>
</proxy>
</proxies>
<servers>
<server>
<username>user</username>
<password>password</password>
<id>central</id>
</server>
<server>
<username>user</username>
<password>password</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://<host>:<port>/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://<host>:<port>/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://<host>:<port>/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://<host>:<port>/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
I have checked that the correct plugin and version exists in artifactory, this does seem to be an access issue. Has something changed between Maven 2 and Maven 3 where the configuration needs updating?
There is a typo in the configuration (probably settings.xml or a POM file): http://:/artifactory/ isn't a valid URL, try http://artifactory/ instead.
EDIT If the URL is valid in a browser, then Maven has no access.
What the error message says: Maven tried to download the file and the server responded with HTTP status 403 (Forbidden). Since it works with a web browser, this is most certainly a problem with settings.xml and permissions on the Artifactory server.
I once had a similar problem with Nexus; it was configured to deny access to certain packages.
Check the log files of the repository server. You can also try to remove any <server> entries in settings.xml - the browser also connects without logging in. And (of course) make sure user names and passwords are correct.
You defined a proxy between your machine and your Artifactory server on the intranet. Usually, that is not the correct setup. Artifactory might need a proxy to reach the servers on the internet (the remote repositories), but maven probably must access Artifactory without proxy.
I fixed this issue by re-downloading and refreshing my Maven 3 install. There must have been something wrong with the install.

Resources