deploying spring mvc project in open shift - spring

Hello everyone I'm new with open shift and GIT and I try to depoly my spring mvc project on open shift and I get errors I can't manage to resolve them to deploy the application.
Plugin org.apache.maven.plugins:maven-war-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.5.1: Failure to find org.apache.maven.plugins:maven-war-plugin:pom:2.5.1 in http://maven.repository.redhat.com/techpreview/all was cached in the local repository, resolution will not be reattempted until the update interval of eap has elapsed or updates are forced -> [Help 1]
[ERROR]
read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
An error occurred executing 'gear postreceive' (exit code: 1)
Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/5674c0e22d5271dc8d000016/jbossews
POM.XML
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>org.test.int1.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>openshift</id>
<build>
<finalName>GestionBP</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<outputEncoding>UTF-8</outputEncoding>
<outputDirectory>webapps</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
Can someone help me. Thank you aa lot

Have you tried removing the forced version number?

Related

Maven checkstyle use wrong style

I have the following configuration in my pom.xml:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
<failOnViolation>true</failOnViolation>
<enableFilesSummary>false</enableFilesSummary>
</configuration>
</plugin>
</plugins>
</reporting>
It is set to use the Google coding style, however is use the sun_checks.xml file (which is the default for this plugin):
mvn checkstyle:check | grep sun
[INFO] There are 913 errors reported by Checkstyle 8.19 with sun_checks.xml ruleset.
What is wrong in my POM configuration?
Thank you in advance.
The configuration should be in <build> and not in <reporting>:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Maven site plugin fails when running on jenkins

I am running maven application "DemoApp" that generates checkstyle static code analysis reports. It works correctly when I run it on eclipse, but when I build it on jenkins it gives the below error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site plugin:3.3:site (default-site) on project DemoApp: Execution default-site of goal org.apache.maven.plugins:maven-site-plugin:3.3:site failed: A required class was missing while executing org.apache.maven.plugins:maven-site-plugin:3
and The following exception :
java.lang.NoClassDefFoundError: org/apache/maven/doxia/siterenderer/DocumentContent
Caused by: java.lang.ClassNotFoundException: org.apache.maven.doxia.siterenderer.DocumentContent
I added the following plugins in pom.xml
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<configLocation>src/main/resources/google_checks.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>false</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
I can't tell whether this solves your current issue but generally: Declarations within <pluginManagement> do not actually set anything in the build process but are intended as a centralized place for declarations common to (sub-)projects:
[...] this only configures plugins that are actually referenced within the plugins element in the children or in the current POM.
See the different versions in the error message: maven-site-plugin:3.3 and in the declaration: <version>3.7.1.
To add such a plugin declaration to the build process you have to declare/reference it additionaly in:
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
</plugin>
</plugins>
...
</build>
The same applies to the maven-checkstyle-plugin:
If you want to report to the console or fail the build, you must add an execution of checkstyle::check to the <build> element and configure any options that you need.

Getting No goals have been specified for this build in Maven despite puttin in the Goals. Please see the updated POM below. Thanks

I am getting the following error when I try to run Maven Test on eclipse. Please see below POM.XML
<build>
<plugins>
<!-- surefire plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<!-- build uploader Linux -->
<suiteXmlFile>src\test\resources\ftp_linux.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>8</source>
<target>8</target>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.8.0_91\bin\javac.exe</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>RegressionTests.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
Please see below for the error message. I have also checked the name of the xml file and it is correct. I am not sure why it is displaying as xml file as not a valid one
[WARNING] The requested profile "Test" could not be activated because it does not exist.
[WARNING] The requested profile "Automation" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project daily-installer: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process
[ERROR] org.apache.maven.surefire.testset.TestSetFailedException: Suite file C:\Users\Admin\Downloads\daily-installer-automation-master\daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a\RegressionTests.xml is not a valid file
[ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.locateTestSets(TestNGXmlTestSuite.java:98)
[ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
[ERROR] -> [Help 1]
[ERROR]
Now I am getting the following error
Here is my updated pom.xml
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>RegressionTests.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<executions>
<execution>
<id>test</id>
<phase>integration-test</phase>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>
RegressionTests.xml
</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
It is now working after I added a Goal tag.

Checker framework cant resolve symbol<annotatedJdk>${org.checkerframework:jdk8:jar}</annotatedJdk> issue

Im trying to add Checker Framework via Maven repository i followed checker framework manual steps but i got this error on intelij ide
someone else mentioned having same issue on Google groups please any help is appreciated
my maven package is like this
<properties>
<annotatedJdk>${org.checkerframework:jdk8:jar}</annotatedJdk>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>jdk8</artifactId>
<version>2.5.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<Xmaxerrs>10000</Xmaxerrs>
<Xmaxwarns>10000</Xmaxwarns>
</compilerArguments>
<annotationProcessorPaths>
<path>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>2.5.1</version>
</path>
</annotationProcessorPaths>
<annotationProcessors><annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
</annotationProcessors>
<compilerArgs>
<arg>-AprintErrorStack</arg>
<arg>-Xbootclasspath/p:${annotatedJdk}</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
tell me if miss any steps it also does not allow deleting that line with error
Assuming that the project is built by Maven from command line correctly, this looks like IntelliJ IDEA highlighting issue: IDEA-129269/IDEA-187553.
The way I was able to avoid this issue is to declare the properties as follows:
<checkerframework.version>2.5.6</checkerframework.version>
<annotatedJdk>${settings.localRepository}/org/checkerframework/jdk8/${checkerframework.version}/jdk8-${checkerframework.version}.jar</annotatedJdk>
Then re-import the Maven project.
Also note that with this it may not be necessary to configure the maven-dependency-plugin either.

Could not find goal 'run' in plugin org.apache.maven.plugins

[ERROR] Could not find goal 'run' in plugin org.apache.maven.plugins:maven-eclipse-plugin:2.10 among available goals clean, configure-workspace, eclipse, help, install-plugins, myeclipse, myeclipse-clean, rad, rad-clean, remove-cache, resolve-workspace-dependencies, to-maven -> [Help 1]
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<!-- put your configurations here -->
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
i have used above plugin. please can anyone suggest me ,what is the issue and where i am wrong .

Resources