Jetty 6 Maven Plugin fails to start on Intellij - maven

I'm moving from Eclipse to Intellij, and switching from Tomcat to Jetty in the dev environment.
My Tomcat plugin works fine, but when I start Jetty it outputs the following error:
Failed to execute goal org.mortbay.jetty:maven-jetty-plugin:6.1.2:run (default-cli) on project projeto: Webapp source directory C:\Users\EvCash - Blue\workspace\projeto\src\main\webapp does not exist -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.mortbay.jetty:maven-jetty-plugin:6.1.2:run (default-cli) on project projeto: Webapp source directory C:\Users\EvCash - Blue\workspace\projeto\src\main\webapp does not exist
Here is my pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.2</version>
<configuration>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
</connector>
</connectors>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
...
</plugins>
</build>
And the run configuration:
jetty:run -e
I tried using the jetty-runner plugin, but it requires JDK 1.8 and I must use the 1.7 version.
Any ideas? Thanks in advance

Related

Visibility of buildnumber-maven-plugin property ${buildNumber}

I am trying to use buildnumber-maven-plugin to append the SCM build number to the WAR artifact name and then use tomcat7-maven-plugin to deploy it but in a context path that doesn't include the build number. So I am making foo-r1234.war where foo is my project and 1234 is the revision number in Subversion but I want to deploy it in a Tomcat context foo.
I got the war generation to reflect the build number but the problem is that the Tomcat plugin doesn't see the ${buildNumber} property assigned by the buildnumber plugin:
<finalName>foo-r${buildNumber}</finalName>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>create-buildno</id>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
...
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8080/manager/text</url>
<path>/foo</path>
<warFile>${project.build.directory}/${project.build.finalName}.war</warFile>
</configuration>
</plugin>
I get
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project foo: Cannot find war file: /my/path/target/foo-r${buildNumber}.war -> [Help 1]
[ERROR]
Which indicates the tomcat plugin doesn't see ${buildNumber}. How can I make it visible in order to deploy foo-r${buildNumber}.war to a context foo in Tomcat?
RELATED:
How to deploy war with automatic buildnumber to tomcat using maven tomcat plugin
timestamp and buildNumber properties not set during deploy goal
Add build final name in configuration
/${project.build.finalName}

Docker maven fabric8 plugin (on Windows): building image gives incompatibility issues ?

Via Maven I would like to build a Docker image from a Springboot project.
I run: mvn clean package docker:build
Issue:
ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.21.0:build (default-cli) on project spring-boot-docker: Execution default-cli of goal io.fabric8:docker-maven-plugin:0.21.0:build failed: An API incompatibility was encountered while executing io.
fabric8:docker-maven-plugin:0.21.0:build: java.lang.UnsatisfiedLinkError: unknown
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>io.fabric8:docker-maven-plugin:0.21.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/Johan/.m2/repository/io/fabric8/docker-maven-plugin/0.21.0/docker-maven-plugin-0.21.0.jar
Etc
The maven pom.xml file contains:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<docker.image.prefix>springframeworkguru</docker.image.prefix>
<docker.image.name>springbootdocker</docker.image.name>
<docker.host.url>unix:///var/run/docker.sock</docker.host.url>
</properties>
The build plugin section contains:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.21.0</version>
<configuration>
<dockerHost>${docker.host.url}</dockerHost>
<verbose>true</verbose>
<images>
<image>
<name>${docker.image.prefix}/${docker.image.name}</name>
<build>
<dockerFileDir>${project.basedir}/src/main/docker/</dockerFileDir>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
As suggested, I removed my maven repository, which did not help.
Using other dockerHost values (like http://127.0.0.1:2375) did not help.
I really hope you can help!
This is the solution on Windows 7, 8 and 10 Home:
Find the docker machine environment variables. Go to the docker (shell) and type: docker-machine env. The docker host and certification path are important.
Add the following properties to your pom.xml (maven) file:
<docker.host.url>(e.g.) tcp://192.168.99.100:2376</docker.host.url>
<docker.host.certPath>(e.g.) a path</docker.host.certPath>
In your build plugin add just after configuration
<dockerHost>${docker.host.url}</dockerHost>
<certPath>${docker.host.certPath}</certPath>

How to check failed module during deployment - Maven multi module

I am deploying application to Jboss AS 7.1.1.Final using Maven multi module configuration. The 'jboss-as-maven-plugin' plugin with version 7.4.Final is used to deploy to AS using remote deployment. I have a parent POM with multiple modules as shown below.
<modules>
<module>ProjectA</module>
<module>ProjectB</module>
<module>ProjectC</module>
<module>ProjectD</module>
</modules>
Configuration in master POM
<plugins>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.4.Final</version>
<configuration>
<skip>true</skip>
<filename>${project.build.finalName}.${project.packaging}</filename>
<username>${userName}</username>
<password>${password}</password>
</configuration>
</plugin>
</plugins>
Configuration in each module's POM
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.4.Final</version>
<configuration>
<filename>${project.build.finalName}.jar</filename>
<username>${userName}</username>
<password>${password}</password>
</configuration>
</plugin>
There has been deployment errors related to connection timeout to Jboss server that can occure while deploying any of the module configured. I am planning on writting script to check when a specific module failed from multi module configuration, will try to redeploy failed module. For this to happen I would need to know which of these module failed during deployment. Is it possible to know while running maven as following command?
mvn clean package install jboss-as:deploy -DskipTests
-DuserName=username -Dpassword=password -Ddeploy.host=10.10.10.10 -Ddeploy.port=9999

Deploying with Maven Tomcat plugin failes

I'm trying to deploy application using tomcat7-maven-plugin with this configuration
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<url>http://127.0.0.1:8080/manager/text</url>
<server>TomcatServer</server>
<path>/Ohta</path>
<username>tomcat</username>
<port>8080</port>
<password>s3cret</password>
</configuration>
</plugin>
I get the folowing error
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project ohta: Cannot invoke Tomcat manager: Connection refused: connect -> [Help 1]
As I understand maven tries to use org.codehaus.mojo:tomcat-maven-plugin instead of specified and can't find configuration, but why it is so?
This link contains a good tutorial about Maven Tomcat plugin. Might be useful to see the whole process from archetype creation to deployment using the plugin.

Tomcat7 Maven Plugin appears to not be picking up url in configuration [duplicate]

This is my pom.xml build configuration:
<build>
<finalName>cfwd</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<url>http://xx.xxx.xxx.xxx:8080/manager/text</url>
<server>cifServer</server>
<path>/cfwd</path>
<addContextWarDependencies>true</addContextWarDependencies>
<addWarDependenciesInClassloader>true</addWarDependenciesInClassloader>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
where http://xx.xxx.xxx.xxx:8080 is the remote server IP.
When I try to deploy via mvn tomcat:deploy I get this error:
[ERROR] Failed to execute goal
org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on
project cfwd: Cannot invoke Tomcat manager: Server returned HTTP
response code: 403 for URL:
http://localhost:8080/manager/deploy?path=%2Fcfwd&war= -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy
(default-cli) on project cfwd: Cannot invoke Tomcat manager
where it looks like maven is attempting to deploy to localhost:8080 rather than the remote server IP. Any idea?
You need to execute mvn tomcat7:deploy (note the '7') in order to trigger the plugin you've configured.
See this page for more information about the available goals.
403 means Forbidden.
Check with the official documentation in order to configure authentication to the Tomcat manager (parameters Server, password, username).
Duncan Jones is right : you are not executing the correct plugin : use tomcat7.

Resources