Deployment issue on an on premise cluster with Maven arm Deployment - Mule 4.4.0 - mule

I am trying to deploy a Mule application to On prem using Maven, but when i execute the command, the result it's a error, could you please told me if anyone know what can i do to solve this problem:
Command:
mvn clean deploy -DmuleDeploy -Dclustername="" -Dusername="" -Dpassword=""
NOTE: clear the parameters shown above in the command...
Message Issue:
Unauthorized Access. Please verify that authToken is valid
Log Maven:
Failed to execute goal org.mule.tools.maven:mule-maven-plugin:3.8.0:deploy (default-
deploy) on project mulesoft-cicd-pipeline: Execution default-deploy of goal
org.mule.tools.maven:mule-maven-plugin:3.8.0:deploy failed: Unauthorized Access. Please
verify that authToken is valid.
POM File - Build Section:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>${mule.maven.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<armDeployment>
<muleVersion>4.4.0</muleVersion>
<uri>https://anypoint.mulesoft.com</uri>
<target>${clustername}</target>
<targetType>cluster</targetType>
<username>${username}</username>
<password>${password}</password>
<environment>Staging</environment>
</armDeployment>
</configuration>
</plugin>
</plugins>
</build>
NOTE: I am using my Anypoint Platform username and password, have access to the cluster but have two-step authorization enabled...
If someone can help me I would appreciate it very much...

You cannot use your user credentials with MFA enabled. Instead use a connected app. It is described in the documentation: https://docs.mulesoft.com/mule-runtime/4.4/deploy-on-premises#authentication-methods

Related

remote deployment to wildfly using cargo fails

I am trying to deploy an application to a remote wildfly 8.1.0.Final using the cargo maven plugin and it fails with error Operation failed: Could not connect to remote://10.0.0.165:9990 in 5000ms.
The application is the default application generated by the maven archetype cargo-archetype-remote-deployment. This application can be successfully deployed to jboss 7.1.1.Final without modification to the pom. I have added the following profile to the pom
<profile>
<id>wildfly8x</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>wildfly8x</containerId>
</container>
<properties>
<!--<cargo.jboss.management-native.port>9999</cargo.jboss.management-native.port>-->
<cargo.jboss.management-http.port>9990</cargo.jboss.management-http.port>
</properties>
</configuration>
<!--
The JBoss remote deployer requires some additional dependencies. Read more on:
http://cargo.codehaus.org/JBoss+Remote+Deployer
-->
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-controller-client</artifactId>
<version>7.0.2.Final</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
which is a copy of the jboss7x profile with the changes for wildfly.
The properties at the beginning have been changed to correct hostname and username and passwords. I can log into the 10.0.0.165:9990 using http and access the web interface I can also us the jboss-cli interface to login to 10.0.0.165:9990 and deploy the application to the server using the command line. I have also increased the time out as recommended but without success.
It would appear that the remote:// protocol is not available in wildfly or the name is incorrect and cargo is expecting to be able to connect using it.
I have had problems with wildfly and the changes made to interfaces in the past when I connected Netbeans 8 to it. I did eventually find the solution to that by adding back the native management interface which was removed in one of the beta versions.
Does anybody have any knowledge on how to get this working? A copy of a pom from a working example would be good. Before replying please make sure that your reply is relevant to the versions specified as jboss/redhat make changes between dot point releases with very little documentation.
Hy,
I just have the same issue, i gues you copy the example from:
http://cargo.codehaus.org/JBoss+Remote+Deployer
And I found that the example is for JBOSS 7...
For Wildfly this is what worked for me:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.12</version>
<configuration>
<container>
<containerId>wildfly8x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.username>consoleUser</cargo.remote.username>
<cargo.remote.password>consolePassword</cargo.remote.password>
<cargo.hostname>IP_ADDRESS</cargo.hostname>
<cargo.jboss.management-http.port>9990</cargo.jboss.management-http.port>
</properties>
</configuration>
</configuration>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-controller-client</artifactId>
<version>8.2.0.Final</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
The shame on this is the documentation and that no java people community have answer this post... have to be a .NET guy... what a shame....

Deploying maven liferay project to remote Jboss based Liferay portal

I'm new with Liferay portal.
here is my config
--Liferay 6.1 deployed on JBoss AS 7.1.1 Final
--Maven 3.1.1
I can easily deploy my portlet(maven project) in local Liferay instance
but i'm trying to deploy this portlet to a remote instance
here is a part of my pom.xml
<properties>
<liferay.version>6.1.2</liferay.version>
<liferay.parent.server>C:\DEV\Env\JBoss</liferay.parent.server>
<liferay.auto.deploy.dir>${liferay.parent.server}\deploy</liferay.auto.deploy.dir>
<liferay.app.server.deploy.dir>${liferay.parent.server}\jboss-as-7.1.1.Final\standalone\deployments</liferay.app.server.deploy.dir>
<liferay.app.server.lib.global.dir>${liferay.parent.server}\jboss-as-7.1.1.Final\modules\com\liferay\portal\main</liferay.app.server.lib.global.dir>
<liferay.app.server.portal.dir>${liferay.parent.server}\jboss-as-7.1.1.Final\standalone\deployments\ROOT.war</liferay.app.server.portal.dir>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.liferay.maven.plugins</groupId>
<artifactId>liferay-maven-plugin</artifactId>
<version>${liferay.version}</version>
<configuration>
<autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir>
<appServerDeployDir>${liferay.app.server.deploy.dir}</appServerDeployDir>
<appServerLibGlobalDir>${liferay.app.server.lib.global.dir}</appServerLibGlobalDir>
<appServerPortalDir>${liferay.app.server.portal.dir}</appServerPortalDir>
<liferayVersion>${liferay.version}</liferayVersion>
<pluginType>portlet</pluginType>
</configuration>
</plugin>
...
</build>
I would " liferay.parent.server " to target the remote directory something like 192.168.1.2/Env/JBoss
I have been working on for a long time
i will really appreciate your helps
Thank you
You need to install the Remote IDE Connector plugin to the remote instance of Liferay portal.
There are both CE version and EE version
Now you can deploy it via your Eclipse: tutorial
Or you can use Jenkins plugin, but be aware this issue (you need to download the source, fix it, and build it)
I remember that Liferay not support remote connector for JBoss.You can see this documents regard enter link description here Maven plugin for JBoss.
Sure, you can do remote deploy by maven plugin. You can read this guide http://www.dontesta.it/blog/en/blog-2/cms/liferay/liferay-maven-come-fare-il-deploy-remoto-dei-plugin/
In this article we will see a possible solution for remotely deploying the artifact of a Liferay project based on the maven
The plugin maven wagon-maven-plugin (or wagon) is what will allow you copy the WAR of our portlet on the remote server and then the hot deployment of Liferay (of which I recommend reading the hot deployment versus auto deploy) will carry out the actual installation. Listing 1 shows the wagon plugin configuration included within the plugins section of our project pom.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<fromDir>${project.build.directory}/</fromDir>
<includes>*.war</includes>
<url>scp://${jboss.deploy.username}:${jboss.deploy.password}#${jboss.deploy.hostname}/</url>
<toDir>${jboss.deploy.liferay.dir}</toDir>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.8</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

Maven release:perform without deploy and calling an external shell script

I am using the maven release plugin. Problem is simple: I don't want to do a deploy on release:perform. I actually want to execute a shell script that will do the deploy for me. So I have two things to accomplish:
Somehow disable the default "deploy" goal from release:perform
Somehow make release:perform call the exec:exec plugin to execute a shell script
Here is my pom:
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
<configuration>
<tagBase>svn://saoj-la.dyndns.org/webapp-test/tags</tagBase>
<connectionUrl>scm:svn:svn://saoj-la.dyndns.org/webapp-test/trunk</connectionUrl>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>/bin/sh</executable>
<arguments>
<argument>run.sh</argument>
</arguments>
</configuration>
</plugin>
A little late, but for reference:
For your step 1, you can disable the maven deploy step by using the "skip" option. Click here for reference.
On the commandline you could call something like:
mvn release:perform -Darguments="-Dmaven.deploy.skip=true"
I am using the maven release plugin. Problem is simple: I don't want to do a deploy on release:perform. I actually want to execute a shell script that will do the deploy for me.
I must be missing something because when I read this, I don't see the point of the script... But let's just say I don't get it.
Somehow disable the default "deploy" goal from release:perform
According to the documentation of release:perform, you can use the optional goals parameter to specify:
A space separated list of goals to execute on deployment. Default value is either deploy or deploy site-deploy, if the project has a <distributionManagement>/<site> element.
You could maybe use install instead of deploy.
Somehow make release:perform call the exec:exec plugin to execute a shell script
Bind it on install in a profile activated during release. Here is one way to do this:
<profile>
<!-- Profile used when the release plugin executes. -->
<id>release</id>
<activation>
<property>
<!-- This property is automatically defined by the Maven release plugin when executing
a release. Thus this profile will be automatically enabled when releasing -->
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
...
</build>
</profile>
But honestly, there is something weird with your request. Maybe giving more details would help.

Maven 2 checkstyle plugin version 2.5 - Problem with configLocation

I am using checkstyle plugin in maven 2. I now want to switch my config file, from the default one to a) an online file, or b) a local file. I tried the following two things, which both didnt work. Any suggestions?
A) Local file, which is directly in my project folder next to the pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
B) Remote file, that is stored on a server
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>http://stud.hs-heilbronn.de/~nischmid/development/checkstyle-config.xml</configLocation>
</configuration>
</plugin>
Both cases result in an error like this:
[INFO] An error has occurred in
Checkstyle report generation. Embedded
error: Failed during checkstyle
execution Could not find resource
'file:checkstyle.xml'.
Any help would be appreciated!
I've seen several issues related to configLocation in Jira with the version 2.5 of the plugin (like MCHECKSTYLE-129 or MCHECKSTYLE-131), both a) and b) just work fine with the version 2.4.
So, unless you're using Maven 3, I suggest to rollback to 2.4 for now:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.4</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugins>
or
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.4</version>
<configuration>
<configLocation>http://stud.hs-heilbronn.de/~nischmid/development/checkstyle-config.xml</configLocation>
</configuration>
</plugin>
As a side note, for a multi-modules build, have a look at the Multimodule Configuration.
I've been trying to use version 3.0.1 of the Checkstyle plugin and found configLocation has no effect. Tried the approach above, but still no luck.
To summarise, the answer above probably does work, but you might need to set a property checkstyle.config.location.
Using -X to get debug output, I saw:
[DEBUG] (f) configLocation = config/sun_checks.xml
Scrolling further back in the log, it looks like configLocation isn't being set:
<configLocation default-value="config/sun_checks.xml">${checkstyle.config.location}</configLocation>
Based on that message, I set the property in the global <properties> as follows:
<checkstyle.config.location>${basedir}/config/checkstyle-configuration.xml</checkstyle.config.location>
This worked, but caused the plugin to throw an exception. After some Googling, I added the following to the checkstyle configuration file:
<module name="Checker">
...
<module name="TreeWalker">
...
<property name="cacheFile" value=""/>
For completeness, the last step came from the following Jira, marked as resolved in 2.8. The difference is it seems to work with an empty value, avoiding the need to set up a ${cachefile} property:
http://jira.codehaus.org/browse/MCHECKSTYLE-159
Maybe helpful for someone else who needs to still find a workaround.
By the way i had the same problem and the file is suppose to be searched in /classes/.xml or folders from here. But since it is looking directly after the project folder i included
<configuration>
<configLocation>src\main\resources\checkstyle-checker-dev.xml</configLocation>
</configuration>
Note: configLocation has L caps
Also you can define a global variable in environment and use here
Note: This is only a workaround, it needs to work as stated in the above lines.

Cargo not working over proxy integrated with maven 2

I have integrated Cargo plugin in my maven 2 project POM.xml.
During hot deployment I am unable to connect to my Tomcat container that is available across a proxy. My maven settings.xml already contain proxy setting but cargo is not picking it up.
I tried defining proxy settings for Cargo plugin expilicitly but that too didn't worked.
My plugin xml for Cargo is as:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<!--<version>1.0.1-alpha-1</version>-->
<version>1.0-beta-1</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.proxy.host>xxx.xxx.xxx.xxx</cargo.proxy.host>
<cargo.proxy.port>xxxx</cargo.proxy.port>
<cargo.hostname>xxx.xxx.xxx.xxx</cargo.hostname>
<cargo.protocol>http</cargo.protocol>
<cargo.servlet.port>80</cargo.servlet.port>
<cargo.tomcat.manager.url>http://xxx.xxx.xxx.xxx/manager</cargo.tomcat.manager.url>
<cargo.remote.username>xxxxxxx</cargo.remote.username>
<cargo.remote.password>xxxxxxx</cargo.remote.password>
</properties>
</configuration>
<deployer>
<type>remote</type>
<deployables>
<deployable>
<groupId>Test</groupId>
<artifactId>Test</artifactId>
<type>war</type>
<!--
<properties> <context>optional root context</context>
</properties> <pingURL>optional url to ping to know if deployable
is done or not</pingURL> <pingTimeout>optional timeout to ping
(default 20000 milliseconds)</pingTimeout>
-->
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
Please help.
Thanks in advance.
Ashish
I may be wrong but I don't think Cargo support this. But, as the remote deployer for Tomcat uses the manager application and thus HTTP, try to set proxy settings at the JVM level by passing properties on the command line when invoking maven:
mvn cargo:deploy -Dhttp.proxyHost=<hostname> -Dhttp.proxyPort=<port>
Or use the environment variable MAVEN_OPTS:
export MAVEN_OPTS="-Dhttp.proxyHost=<hostname> -Dhttp.proxyPort=<port>"
Hopefully this issue with proxy will be fixed in Cargo 1.1.0