cargo-maven2-plugin:start fails with "Actually there are no valid types registered for this configuration", regardless of what containerId I enter - cargo

I'm trying to run integration tests with the cargo-maven2-plugin and Tomcat 8. I want the Maven build to start the container for me, so I have configured the start and stop goals as documented here. The problem is that regardless of what I enter as containerId, the start goal always fails with a message saying that there are no registered configurations. The error messages always ends in
Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it?
I've tried various configurations, including ones that I found in various tutorials, and ones that user older Tomcat versions, but nothing helps. The error message is always the same.
Other posts here on Stack Overflow recommend to update the Cargo versions, but this doesn't apply to my problem: I already use the latest release version (1.6.5).
So, why do I keep getting this error?
For reference, here is one complete configuration that I tried out:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.6.5</version>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<artifactInstaller>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>8.5.23</version>
</artifactInstaller>
</container>
<configuration>
<type>standalone</type>
</configuration>
<deployables>
<!-- ... -->
</deployables>
</configuration>
</plugin>
The full error message for this configuration is:
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.6.5:start (start-container) on project domain.db.itest: Execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.6.5:start failed: Cannot create configuration. There's no registered configuration for the parameters (container [id = [tomcat8x], type = [installed]], configuration type [standalone]). Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it? -> [Help 1]

The solution was incredibly simple: I had the offline mode enabled. Without offline mode, Cargo downloaded the cargo-core-container-tomcat artifact, and apparently this artifact contains the definition of the tomcat8x configuration. Then, the container start was successful!
I had started the Maven build from Eclipse, so I didn't notice that the offline mode was enabled. I'm aware that this situation is quite special, but maybe someone else still benefits from my insight. It took me a while to solve, so I'm sharing problem and solution here. (After all, this is encouraged :-)
I got the key hint from a mailing list post, where thecargo-core-container-tomcat artifact was not downloaded due to a Nexus repository configuration.

This error is sometimes due to the cargo plugin version. Update your cargo plugin to the higher or latest version.
In my case, I updated from cargo 1.4.8 to cargo 1.7.0.
check this link,its may help:
click here

Related

Jenkins:can not see test report tab

I can not see report tab here:
Public Junit test report:
I have configured Public JUnit test report, but I still can not see test report in left area.
As the OP joan.li adds in the comments, you need to make sure Your Jenkins installation knows about maven (as mentioned in "Jenkins executing maven from incorrect path"):
Add the default maven installation under (Jenkins -> configuration)
Goto the failing job and make sure you choose the default maven installation from dropdown
And You need to make sure your pom.xml does include a surefire build step
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
See also this example.
Check if those xml files are generated

Using Maven to build iOS

I am having issues with getting Maven to build out my iOS app. My plug in is set up like so:
<plugin>
<groupId>com.sap.prd.mobile.ios.mios</groupId>
<artifactId>xcode-maven-plugin</artifactId>
<version>1.14.0</version>
<extensions>true</extensions>
<configuration>
<settings>
<ARCHS>armv7 armv7s</ARCHS>
<ONLY_ACTIVE_ARCH>NO</ONLY_ACTIVE_ARCH>
</settings>
<sdks>
<sdk>iphonesimulator</sdk>
</sdks>
<configurations>
<configuration>Debug</configuration>
</configurations>
</configuration>
</plugin>
However, I'm getting the error:
The build has not been performed for default configuration 'Release' and default sdk 'iphoneos'
even though I'm trying to exclude Release by adding only the Debug configuration. What am I doing wrong here? I'd like to also build release, but I am trying to exclude it for now since it is giving me issues.
I've been stuck on this for about a month, sadly. So, any insight would be greatly appreciated.
Turns out there was a bug with version 1.14.0. Please update to version 1.14.1 of this xcode-maven-plugin to fix this issue.

Enunciate multiple time running with maven

I'm using enunciate 1.27 and maven 3.0.4 .
My problem occurs when I run enunciate multiple times :
[INFO]
[INFO] --- maven-enunciate-plugin:1.27:assemble (number2) # yaghut-web ---
[INFO] initializing enunciate.
[INFO] [csharp] C# compilation is disabled, but the source code will still be generated.
[INFO] invoking enunciate:generate step...
An exception has occurred in apt (1.6.0_30). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.apt.comp.Apt$AptTreeScanner.visitAnnotation(Apt.java:161)
at com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:1794)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:33)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:41)
at com.sun.tools.javac.tree.TreeScanner.visitModifiers(TreeScanner.java:266)
at com.sun.tools.javac.tree.JCTree$JCModifiers.accept(JCTree.java:1816)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:33)
at com.sun.tools.javac.tree.TreeScanner.visitClassDef(TreeScanner.java:60)
at com.sun.tools.apt.comp.Apt$AptTreeScanner.visitClassDef(Apt.java:146)
at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:575)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:33)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:41)
at com.sun.tools.javac.tree.TreeScanner.visitTopLevel(TreeScanner.java:52)
at com.sun.tools.apt.comp.Apt$AptTreeScanner.visitTopLevel(Apt.java:124)
at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:446)
at com.sun.tools.apt.comp.Apt.main(Apt.java:213)
....
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
I execute enunciate in this way:
<execution>
<id>number1</id>
<goals>
<goal>assemble</goal>
</goals>
<configuration>
<configFile>src/main/enunciate_number1.xml</configFile>
<compilationEncoding>UTF-8</compilationEncoding>
<generateDir>${project.build.directory}/enunciate/number1/generate</generateDir>
<compileDir>${project.build.directory}/enunciate/number1/compile</compileDir>
<buildDir>${project.build.directory}/enunciate/number1/build</buildDir>
</configuration>
</execution>
<execution>
<id>number2</id>
<goals>
<goal>assemble</goal>
</goals>
<configuration>
<configFile>${project.basedir}/src/main/enunciate_number2.xml</configFile>
<compilationEncoding>UTF-8</compilationEncoding>
<generateDir>${project.build.directory}/enunciate/number2/generate</generateDir>
<compileDir>${project.build.directory}/enunciate/number2/compile</compileDir>
<buildDir>${project.build.directory}/enunciate/number2/build</buildDir>
</configuration>
</execution>
when I executed enunciate one time (I mean omit number2) everything work correctly.
I guessed 'generateDir' in second execution was not set correctly. When I omit it, nothing was generated (message was: everythis appears up-to-date); and with current configuration, NullPointerException is thrown.
any idea?
thanks.
I don't know much about how to configure Maven to get this right, but an alternative approach might be to use the maven-antrun-plugin to invoke Enunciate twice instead of trying to get Maven to do it. The configuration would look kinda like the contents of the "getting-started-examples" target at line 199 in build-site.xml.

Jenkins fails build but on local machine everething is ok

[INFO] Fork Value is true
[java] The following errors occurred during analysis:
[java] Aug 09, 2013 3:16:04 PM edu.umd.cs.findbugs.TextUIBugReporter reportAnalysisError
[java] SEVERE: Unable to get XClass for java/lang/StringBuilder
...
After these messages Jenkins ends build with failure. On local machine i got these messages too, but nothing interrupts, and findbugs, pmd and checkstyle finish correctly.
Also on Jenkins i got
[PMD] No report found for mojo check
[FINDBUGS] No report found for mojo check
, but on local machine i don't. Seems like these two stranges are linked, how can i fix them?
I run mvn verify.
SCA included in pom.xml in build section like
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<skip>false</skip>
<failOnViolation>false</failOnViolation>
<failOnError>false</failOnError>
<xmlOutput>true</xmlOutput>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>findbugs</goal>
</goals>
</execution>
</executions>
</plugin>
The problem was in different jdks. On local machine i have 1.7, but on Jenkins - 1.8, so i simply changed version. And seems like roots of this bug are in jdk 1.8.
apparently, the class structure changed in Java 8. Therefore, FindBugs version 2.0.3 (latest release as of 1. Mai 2014) and earlier fail on classes compiled on JDK 1.8 (or later). They already fixed this in the FindBugs development version (not released as of 4. May 2014). The latest maven plugin (findbugs-maven-plugin:2.5.3) uses FindBugs 2.0.2.
I decided to generate the maven reports with Java 7, until the fix (and a new FindBugs maven plugin version using it) is released.
to generate the reports with Java 7 (linux):
JAVA_HOME=${HOME}/Software/jdk1.7 mvn site
related FindBugs bug reports:
http://sourceforge.net/p/findbugs/bugs/1271/
http://sourceforge.net/p/findbugs/bugs/1264/

maven-war-plugin overlay and m2e eclipse plugin

I'm trying to leverage the useful overlay feature of the maven-war-plugin.
In other words, I have a template (packaged as WAR file, template-0.0.1.war) containing tag files, css, js and images.
When I set template-0.0.1.war as a dependency of the myApp project I get a final myApp.war containing all the files of template-0.0.1.war overwritten by those with the same path in the myApp project.
This is the behavior I want.
However, I need to introduce in the pom.xml of myApp a configuration of the maven-war-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webResources>
<resource>
<directory>../path/to/another/dir</directory>
</resource>
</webResources>
</configuration>
</plugin>
As soon as I introduce such a configuration of the plugin, I obtain the final myApp.war with all the files from both template-0.0.1.war and myApp project but the files of template-0.0.1.war overwrite those with the same path in the myApp project.
This behavior is exactly the opposite of what I expect.
Can someone tell me where I'm wrong?
Thanks in advance.
Edit after the solution was found:
The described issue is due to the concurrency of different actions: the WAR overlay (which works correctly) and the external webResources.
In fact, the external webResources tag points to the template project directory: totally unuseful for Maven, but indispensable to "fool" the m2e eclipse plugin and let it see the custom tags contained in the template.
The solution I have adopted is to introduce 2 different profiles in the plugin section of my pom.xml: the first one called "eclipse" in which I inserted the maven-war-plugin with the webResources and a second profile (called "standard" and activated by default) without the maven-war-plugin.
From the maven war plugin documentation:
By default, the source of the project (a.k.a the current build) is added first (e.g. before any overlay is applied). The current build is defined as a special overlay with no groupId, artifactId. If overlays need to be applied first, simply configure the current build after those overlays.
If you have files in the template that are being overwritten by files in the child WAR, you may want to consider explicitly excluding them in the overlay configuration.
Here's what the documentation says to apply the overlay first:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<overlays>
<overlay>
<groupId>com.example.projects</groupId>
<artifactId>my-webapp</artifactId>
</overlay>
<overlay>
<!-- empty groupId/artifactId represents the current build -->
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>

Resources