While trying to install the maven-sync-plugin to a centralized repository like Archiva/Artifactory
sometimes an authorization error happens as follows
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts:
Could not transfer artifact com.oracle.maven:oracle-maven-sync:jar:12.1.3-0-0 f
rom/to remote-repository (http://localhost:8091/artifactory/internal): Failed to
transfer file: http://localhost:8091/artifactory/internal/com/oracle/maven/orac
le-maven-sync/12.1.3-0-0/oracle-maven-sync-12.1.3-0-0.jar. Return code is: 401,
ReasonPhrase: Unauthorized. -> [Help 1]
This can be resolved by doing the following steps
1) Create a new user called demouser in the Archiva/Artifactory
2) Give the permissions to the user to the desired repositories
3) encrypt the password using the command mvn -ep <password>
4)Use the encrypted password in the settings.xml, as 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">
<profiles>
<profile>
<id>default</id>
<repositories>
<repository>
<id>internal</id>
<name>internal</name>
<url>http://localhost:8091/artifactory/internal</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshot</id>
<name>snapshot</name>
<url>http://localhost:8091/artifactory/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
<mirrors>
<mirror>
<id>mirror</id>
<name>mirror</name>
<url>http://localhost:8091/artifactory/repo1</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<servers>
<server>
<id>internal</id>
<username>demouser</username>
<password>{y2ZZOfE4lLkH78iLLX9xLQjL2/Rkoocq/Yq5HrACJdM=}</password>
</server>
<server>
<id>snapshot</id>
<username>demouser</username>
<password>{y2ZZOfE4lLkH78iLLX9xLQjL2/Rkoocq/Yq5HrACJdM=}</password>
</server>
</servers>
</settings>
6)Also create a master password using mvn -emp <masterpassword>
7)Create a settings-security.xml with the encrypted master password as shown below
Note: replace your master password inside the <master> tag
<settingsSecurity>
<master>{nng7rwwwwKMHM+yJE3201WFQ1WlzYUfgoZGxW2mIcTc=}</master>
</settingsSecurity>
8)Place this settings.xml and settings-security.xml under <userhome>/.m2 directory
9) Now execute the install command as follows.
open the command prompt
Navigate to <ORACLE_HOME>\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3
The execute the following command at the prompt :
mvn deploy:deploy-file -DpomFile=oracle-mave
n-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar -Durl=http://localhost:8091/artifactory/internal -DrepositoryId=internal
Note : Ensure the -DrepositoryId is spelled as given in the above command(case sensitive). Don't use -DRepositoryId
10)Once this command runs successfully, then execute the push goal as shown below
mvn com.oracle.maven:oracle-maven-sync:push
-DoracleHome=C:\installed\Oracle\Middleware12C\Oracle_Home -DserverId=internal
This too will now run successfully and your repository will now have all the necessary artifacts installed .
11) To validate your installation run the following command. This will show all the availble goals which you can now use
mvn help:describe -DgroupId=com.oracle.soa.plugin -DartifactId=oracle-soa-plugin -Dversion=12.1.3-0-0
The result will be as follows
====================================
This plugin has 6 goals:
oracle-soa:compile
Description: Compiles the composite. Note that 'compiling' a composite does
not actually produce any new files, it is really a 'validation' and
produces only output messages.
oracle-soa:deploy
Description: To deploy a SOA composite (supports all formats SAR, MAR,
etc.)
oracle-soa:help
Description: Display help information on oracle-soa-plugin.
Call mvn oracle-soa:help -Ddetail=true -Dgoal=<goal-name> to display
parameter details.
oracle-soa:sar
Description: Packages the composite into a SAR.
oracle-soa:test
Description: To execute SCA Test Suites.
oracle-soa:undeploy
Description: Undeploy a SOA composite from a SOA managed server or cluster
For more information, run 'mvn help:describe [...] -Ddetail'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
sometimes an authorization error happens as follows
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts:
Could not transfer artifact com.oracle.maven:oracle-maven-sync:jar:12.1.3-0-0 f
rom/to remote-repository (http://localhost:8091/artifactory/internal): Failed to
transfer file: http://localhost:8091/artifactory/internal/com/oracle/maven/orac
le-maven-sync/12.1.3-0-0/oracle-maven-sync-12.1.3-0-0.jar. Return code is: 401,
ReasonPhrase: Unauthorized. -> [Help 1]
This can be resolved by doing the following steps
1) Create a new user called demouser in the Archiva/Artifactory
2) Give the permissions to the user to the desired repositories
3) encrypt the password using the command mvn -ep <password>
4)Use the encrypted password in the settings.xml, as 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">
<profiles>
<profile>
<id>default</id>
<repositories>
<repository>
<id>internal</id>
<name>internal</name>
<url>http://localhost:8091/artifactory/internal</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshot</id>
<name>snapshot</name>
<url>http://localhost:8091/artifactory/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
<mirrors>
<mirror>
<id>mirror</id>
<name>mirror</name>
<url>http://localhost:8091/artifactory/repo1</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<servers>
<server>
<id>internal</id>
<username>demouser</username>
<password>{y2ZZOfE4lLkH78iLLX9xLQjL2/Rkoocq/Yq5HrACJdM=}</password>
</server>
<server>
<id>snapshot</id>
<username>demouser</username>
<password>{y2ZZOfE4lLkH78iLLX9xLQjL2/Rkoocq/Yq5HrACJdM=}</password>
</server>
</servers>
</settings>
6)Also create a master password using mvn -emp <masterpassword>
7)Create a settings-security.xml with the encrypted master password as shown below
Note: replace your master password inside the <master> tag
<settingsSecurity>
<master>{nng7rwwwwKMHM+yJE3201WFQ1WlzYUfgoZGxW2mIcTc=}</master>
</settingsSecurity>
8)Place this settings.xml and settings-security.xml under <userhome>/.m2 directory
9) Now execute the install command as follows.
open the command prompt
Navigate to <ORACLE_HOME>\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3
The execute the following command at the prompt :
mvn deploy:deploy-file -DpomFile=oracle-mave
n-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar -Durl=http://localhost:8091/artifactory/internal -DrepositoryId=internal
Note : Ensure the -DrepositoryId is spelled as given in the above command(case sensitive). Don't use -DRepositoryId
10)Once this command runs successfully, then execute the push goal as shown below
mvn com.oracle.maven:oracle-maven-sync:push
-DoracleHome=C:\installed\Oracle\Middleware12C\Oracle_Home -DserverId=internal
This too will now run successfully and your repository will now have all the necessary artifacts installed .
11) To validate your installation run the following command. This will show all the availble goals which you can now use
mvn help:describe -DgroupId=com.oracle.soa.plugin -DartifactId=oracle-soa-plugin -Dversion=12.1.3-0-0
The result will be as follows
====================================
This plugin has 6 goals:
oracle-soa:compile
Description: Compiles the composite. Note that 'compiling' a composite does
not actually produce any new files, it is really a 'validation' and
produces only output messages.
oracle-soa:deploy
Description: To deploy a SOA composite (supports all formats SAR, MAR,
etc.)
oracle-soa:help
Description: Display help information on oracle-soa-plugin.
Call mvn oracle-soa:help -Ddetail=true -Dgoal=<goal-name> to display
parameter details.
oracle-soa:sar
Description: Packages the composite into a SAR.
oracle-soa:test
Description: To execute SCA Test Suites.
oracle-soa:undeploy
Description: Undeploy a SOA composite from a SOA managed server or cluster
For more information, run 'mvn help:describe [...] -Ddetail'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
No comments:
Post a Comment