I'm getting this error while going through Spring in Action: 3rd edition: Chapter 1. I've managed to get the source code from the website to work. My IDE is STS. Thanks
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - Knights:Knights:jar:0.0.1-SNAPSHOT
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 7 source files to E:\SpringInAction\Knights\target\classes
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\SpringInAction\Knights\src\test\resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 1 source file to E:\SpringInAction\Knights\target\test-classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
E:\SpringInAction\Knights\src\test\java\com\springinaction\knights\BraveKnightTest.java:[3,7] static import declarations are not supported in -source 1.3
(use -source 5 or higher to enable static import declarations)
import static org.mockito.Mockito.*;
E:\SpringInAction\Knights\src\test\java\com\springinaction\knights\BraveKnightTest.java:[8,3] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
#Test
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Wed Aug 24 00:12:45 CDT 2011
[INFO] Final Memory: 12M/232M
[INFO] -----------------------------------------------------------
Add this to your pom in order to tell Maven to use Version 5 of Java, by default it uses version 1.3 (see documentation):
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Related
My pom.xml has following content
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
</configuration>
</plugin>
when I run mvn surefire-report::report I am getting following
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------------------------------------------------------
[INFO] Building TestApp 0.0.1-SNAPSHOT
[INFO] -----------------------------------------------------------------------
[INFO]
[INFO] >>> maven-surefire-report-plugin:2.18.1:report (default-cli) > [surefir
test # TestApp >>>
[WARNING] The POM for org.testng:testng:jar:5.14.3 is invalid, transitive depe
encies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.testng:testng:jar:5.14.4 is invalid, transitive depe
encies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.testng:testng:jar:5.14.5 is invalid, transitive depe
encies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # TestApp
-
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources
i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # TestApp ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) #
stApp ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\nikhil.udgirkar\workspace\
stApp\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # TestA
---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # TestApp ---
[INFO]
[INFO] <<< maven-surefire-report-plugin:2.18.1:report (default-cli) < [surefir
test # TestApp <<<
[INFO]
[INFO] --- maven-surefire-report-plugin:2.18.1:report (default-cli) # TestApp
-
[WARNING] Unable to locate Test Source XRef to link to - DISABLED
[INFO] -----------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------------------
[INFO] Total time: 3.316 s
[INFO] Finished at: 2016-09-26T12:37:33+05:30
[INFO] Final Memory: 17M/215M
[INFO] ---------------------------------------------------------------------
When I issued following command I am getting blank report
mvn surefire-report:report
I can get the .class files in it's respective folder
Thanks for your time
I am using Maven with the Cobertura and SonarQube plug-ins. I want the results in cobertura.ser to be uploaded to SonarQube. This is my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>delta.coverage.mvp</groupId>
<artifactId>delta.coverage.mvp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.host.url>http://192.168.1.10:9000</sonar.host.url>
<sonar.jdbc.driverClassName>org.h2.Driver</sonar.jdbc.driverClassName>
<sonar.language>java</sonar.language>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.login>admin</sonar.login>
<sonar.password>adminpwd</sonar.password>
<sonar.projectKey>delta.coverage.mvp</sonar.projectKey>
<sonar.projectName>delta.coverage.mvp</sonar.projectName>
<sonar.projectVersion>test</sonar.projectVersion>
<sonar.sources>src/main/java</sonar.sources>
<sonar.java.coveragePlugin>cobertura</sonar.java.coveragePlugin>
<sonar.junit.reportsPath>${project.basedir}/target/surefire-reports</sonar.junit.reportsPath>
<sonar.surefire.reportsPath>${project.basedir}/target/surefire-reports</sonar.surefire.reportsPath>
<sonar.cobertura.reportPath>${project.basedir}/target/cobertura/cobertura.ser</sonar.cobertura.reportPath>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<instrumentation>
<includes>
<include>**/*.class</include>
</includes>
</instrumentation>
</configuration>
<executions>
<execution>
<id>clean</id>
<phase>pre-site</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
<execution>
<id>instrument</id>
<phase>site</phase>
<goals>
<goal>instrument</goal>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- SonarQube Plugin -->
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.0.2</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<!-- use mvn cobertura:cobertura to generate cobertura reports -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</reporting>
</project>
I am running mvn clean cobertura:cobertura sonar:sonar in order to build, unit-test (with coverage) and analyze the code+upload the unit test results. The analysis (SonarQube scan) is uploaded successfully. However, the Cobertura results are not uploaded to SonarQube. Instead, the log shows that Maven actually looked for JaCoCo files:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building delta.coverage.mvp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # delta.coverage.mvp ---
[INFO] Deleting /home/phil/git/delta-coverage-mvp/target
[INFO]
[INFO] >>> cobertura-maven-plugin:2.7:cobertura (default-cli) > [cobertura]test # delta.coverage.mvp >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # delta.coverage.mvp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # delta.coverage.mvp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/phil/git/delta-coverage-mvp/target/classes
[INFO]
[INFO] --- cobertura-maven-plugin:2.7:instrument (default-cli) # delta.coverage.mvp ---
[INFO] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[INFO] Cobertura: Saved information on 1 classes.
[INFO] Cobertura: Saved information on 1 classes.
[INFO] Instrumentation was successful.
[INFO] NOT adding cobertura ser file to attached artifacts list.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # delta.coverage.mvp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # delta.coverage.mvp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/phil/git/delta-coverage-mvp/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # delta.coverage.mvp ---
[INFO] Surefire report directory: /home/phil/git/delta-coverage-mvp/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running delta.coverage.mvp.package1.Test1
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.202 sec
[INFO] Cobertura: Loaded information on 1 classes.
[INFO] Cobertura: Saved information on 1 classes.
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] <<< cobertura-maven-plugin:2.7:cobertura (default-cli) < [cobertura]test # delta.coverage.mvp <<<
[INFO]
[INFO] --- cobertura-maven-plugin:2.7:cobertura (default-cli) # delta.coverage.mvp ---
[INFO] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[INFO] Cobertura: Loaded information on 1 classes.
Report time: 108ms
[INFO] Cobertura Report generation was successful.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building delta.coverage.mvp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.0.2:sonar (default-cli) # delta.coverage.mvp ---
[INFO] User cache: /home/phil/.sonar/cache
[INFO] Load global repositories
[INFO] Load global repositories (done) | time=517ms
[INFO] User cache: /home/phil/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=116ms
[INFO] SonarQube version: 5.6.1
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=193ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=143ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=1824ms
[WARNING] 'sonar.dynamicAnalysis' is deprecated since version 4.3 and should no longer be used.
[INFO] Publish mode
[INFO] ------------- Scan delta.coverage.mvp
[INFO] Language is forced to java
[INFO] Load server rules
[INFO] Load server rules (done) | time=966ms
[INFO] Base dir: /home/phil/git/delta-coverage-mvp
[INFO] Working dir: /home/phil/git/delta-coverage-mvp/target/sonar
[INFO] Source paths: src/main/java
[INFO] Test paths: src/test/java
[INFO] Binary dirs: target/classes
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] 2 files indexed
[INFO] Quality profile for java: Cloud Managed Services - 201503
[INFO] JaCoCoSensor: JaCoCo report not found : /home/phil/git/delta-coverage-mvp/target/jacoco.exec
[INFO] JaCoCoItSensor: JaCoCo IT report not found: /home/phil/git/delta-coverage-mvp/target/jacoco-it.exec
[INFO] Sensor JavaSquidSensor
[INFO] Configured Java source version (sonar.java.source): none
[INFO] JavaClasspath initialization...
[INFO] JavaClasspath initialization done: 12 ms
[INFO] JavaTestClasspath initialization...
[INFO] JavaTestClasspath initialization done: 4 ms
[INFO] Java Main Files AST scan...
[INFO] 1 source files to be analyzed
[INFO] Java Main Files AST scan done: 193 ms
[INFO] 1/1 source files have been analyzed
[INFO] Java bytecode scan...
[INFO] Java bytecode scan done: 18 ms
[INFO] Java Test Files AST scan...
[INFO] 1 source files to be analyzed
[INFO] Java Test Files AST scan done: 56 ms
[INFO] 1/1 source files have been analyzed
[INFO] Package design analysis...
[INFO] Package design analysis done: 4 ms
[INFO] Sensor JavaSquidSensor (done) | time=560ms
[INFO] Sensor Lines Sensor
[INFO] Sensor Lines Sensor (done) | time=1ms
[INFO] Sensor SurefireSensor
[INFO] parsing /home/phil/git/delta-coverage-mvp/target/surefire-reports
[INFO] Sensor SurefireSensor (done) | time=54ms
[INFO] Sensor SCM Sensor
[INFO] SCM provider for this project is: git
[INFO] 2 files to be analyzed
[INFO] 0/2 files analyzed
[WARNING] Missing blame information for the following files:
[WARNING] * /home/phil/git/delta-coverage-mvp/src/main/java/delta/coverage/mvp/package1/Class1.java
[WARNING] * /home/phil/git/delta-coverage-mvp/src/test/java/delta/coverage/mvp/package1/Test1.java
[WARNING] This may lead to missing/broken features in SonarQube
[INFO] Sensor SCM Sensor (done) | time=112ms
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=5ms
[INFO] Sensor Code Colorizer Sensor
[INFO] Sensor Code Colorizer Sensor (done) | time=1ms
[INFO] Sensor CPD Block Indexer
[INFO] JavaCpdBlockIndexer is used for java
[INFO] Sensor CPD Block Indexer (done) | time=159ms
[INFO] Calculating CPD for 1 files
[INFO] CPD calculation finished
[INFO] Analysis report generated in 57ms, dir size=13 KB
[INFO] Analysis reports compressed in 14ms, zip size=8 KB
[INFO] Analysis report uploaded in 218ms
[INFO] ANALYSIS SUCCESSFUL, you can browse http://192.168.1.10:9000/dashboard/index/delta.coverage.mvp
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at http://192.168.1.10:9000/api/ce/task?id=AVbYSBOBTyY3I5vbl2iO
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.175 s
[INFO] Finished at: 2016-08-29T16:50:17-05:00
[INFO] Final Memory: 31M/666M
[INFO] ------------------------------------------------------------------------
The problem was that the the Cobertura plug-in on the SQ server was not installed. I installed it and everything worked fine.
Unfortunately nothing in the mvn log showed that Cobertura was invoked, and I assumed that the SQ server would support Cobertura by default since it's one of the main coverage tools for Java. Very counter-intuitive, but at least there is a simple solution.
I have a maven project, and as I move to production I want the build to fail on any compiler warnings.
I have looked through the web and configured my pom.xml with guidance from this SO post
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArgument>-Werror</compilerArgument>
<compilerArgument>-Xlint</compilerArgument>
<fork>true</fork>
</configuration>
</plugin>
In my project, I removed some parameterization to create an unchecked cast:
return ((Map<String, Object>)getProperty("settings", Map.class).get("aSetting");
Which is correctly identified by both eclipse and maven as a compiler warning. However, despite the warning showing up in maven's compile log, the project still compiles and returns success:
sysadmin#ubunyu:~/workspace/project$ mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building My Project 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) # project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.4:compile (default-compile) # project ---
[INFO] Compiling 13 source files to /home/sysadmin/workspace/project/target/classes
[WARNING] /home/sysadmin/workspace/project/src/main/java/project/package/MyClass.java:[305,69] [unchecked] unchecked cast
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.753s
[INFO] Finished at: Fri Jul 24 11:50:03 EDT 2015
[INFO] Final Memory: 8M/161M
[INFO] ------------------------------------------------------------------------
----------------
I've tried different combinations of -Werror, -Xlint, fork, showWarning, and showDepreciation in the compiler configuration, but nothing is producing an compilation error as I'd expect.
Use
<compilerArguments>
<Xlint/>
<Xlint>cast</Xlint>
</compilerArguments>
I am trying to setup the Continuous deployment process for a Tomcat based java app using Github for source code hosting, TravisCI for building the WAR file, running the unit tests and then Heroku to deploy the packaged WAR file.
I tried following the tutorial from
https://devcenter.heroku.com/articles/deploying-war-files-to-heroku-from-travis-ci#creating-a-java-web-application
I am getting an error while running the below step from the above tutorial:
mvn clean heroku:deploy-war
Command outpt:
$ mvn -e clean heroku:deploy-war
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.example:travis-heroku-java-example:war:0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 31, column 10
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simple Web Application 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.3:clean (default-clean) # travis-heroku-java-example ---
[INFO] Deleting file set: /home/ciuser/travis-heroku-java-example/target (included: [**], excluded: [])
[INFO]
[INFO] >>> heroku-maven-plugin:0.3.6:deploy-war (default-cli) # travis-heroku-java-example >>>
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) # travis-heroku-java-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/ciuser/travis-heroku-java-example/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) # travis-heroku-java-example ---
[INFO] Compiling 1 source file to /home/ciuser/travis-heroku-java-example/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) # travis-heroku-java-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/ciuser/travis-heroku-java-example/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) # travis-heroku-java-example ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # travis-heroku-java-example ---
[INFO] No tests to run.
[INFO] Surefire report directory: /home/ciuser/travis-heroku-java-example/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # travis-heroku-java-example ---
[INFO] Packaging webapp
[INFO] Assembling webapp [travis-heroku-java-example] in [/home/ciuser/travis-heroku-java-example/target/travis-heroku-java-example]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/ciuser/travis-heroku-java-example/src/main/webapp]
[INFO] Webapp assembled in [86 msecs]
[INFO] Building war: /home/ciuser/travis-heroku-java-example/target/travis-heroku-java-example.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] <<< heroku-maven-plugin:0.3.6:deploy-war (default-cli) # travis-heroku-java-example <<<
[INFO]
[INFO] --- heroku-maven-plugin:0.3.6:deploy-war (default-cli) # travis-heroku-java-example ---
[INFO] Configured Artifact: com.github.jsimone:webapp-runner:7.0.57.2:jar
[INFO] Copying webapp-runner-7.0.57.2.jar to /home/ciuser/travis-heroku-java-example/target/dependency/webapp-runner.jar
[INFO] ---> Packaging application...
[INFO] - app: possessed-cemetery-7933
[INFO] - including: target/dependency/webapp-runner.jar
[INFO] - including: target/travis-heroku-java-example.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.636s
[INFO] Finished at: Fri Apr 24 03:33:35 UTC 2015
[INFO] Final Memory: 19M/46M
[INFO] ------------------------------------------------------------------------
[**ERROR] Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.3.6:deploy-war (default-cli) on project travis-heroku-java-example: Failed to deploy application: Forbidden -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.3.6:deploy-war (default-cli) on project travis-heroku-java-example: Failed to deploy application**
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to deploy application
at com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo.java:24)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.http.client.HttpResponseException: Forbidden
at com.heroku.sdk.deploy.RestClient.handleResponse(RestClient.java:87)
at com.heroku.sdk.deploy.RestClient.get(RestClient.java:26)
at com.heroku.sdk.deploy.ConfigVars.getConfigVars(ConfigVars.java:39)
at com.heroku.sdk.deploy.ConfigVars.merge(ConfigVars.java:22)
at com.heroku.sdk.deploy.App.mergeConfigVars(App.java:152)
at com.heroku.sdk.deploy.App.deploy(App.java:81)
at com.heroku.sdk.deploy.App.deploy(App.java:87)
at com.heroku.sdk.deploy.WarApp.deploy(WarApp.java:29)
at com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo.java:20)
... 21 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
$
Error Message in the above output:
[**ERROR] Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.3.6:deploy-war (default-cli) on project travis-heroku-java-example: Failed to deploy application: Forbidden -> [Help 1]
Here is the Maven System configuration:
$ mvn -version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-79-generic", arch: "amd64", family: "unix"
Java Version is:
$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
$
Pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>travis-heroku-java-example</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Simple Web Application</name>
<dependencies>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-servlet_2.4_spec</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>rubygems-releases</id>
<url>http://rubygems-proxy.torquebox.org/releases</url>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>travis-heroku-java-example</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>0.3.6</version>
<configuration>
<appName>possessed-cemetery-7933</appName>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>0.3.6</version>
<configuration>
<appName>boiling-beach-1111</appName>
</configuration>
</plugin>
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>gem-maven-plugin</artifactId>
<version>1.0.5</version>
<configuration>
<execArgLines>
<execArgLine>${project.build.directory}/rubygems/bin/travis</execArgLine>
<execArgLine>encrypt</execArgLine>
<execArgLine>HEROKU_API_KEY=${herokuApiKey}</execArgLine>
</execArgLines>
</configuration>
<dependencies>
<dependency>
<groupId>rubygems</groupId>
<artifactId>travis</artifactId>
<version>1.7.1</version>
<type>gem</type>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>pry</artifactId>
<version>0.9.12.6</version>
<type>gem</type>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
I found what the issue was!!!
Heroku deploy-war maven plugin requires Maven 3.2.X version while I was using 3.0.X version.
Installed Maven 3.2.1 version on my ubuntu machine and the war file was successfully deployed to Heroku.
I got to know this from Github Heroku Maven plugin repository Readme file:
Requirements
Maven 3.2.x
Java 1.7 or higher
Thank you #Steve for your time.
Output:
$ maven -version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T17:37:52+00:00)
Maven home: /usr/share/maven3
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-79-generic", arch: "amd64", family: "unix"
$
$
$
$ maven -e clean heroku:deploy-war
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.example:travis-heroku-java-example:war:0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 31, column 11
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simple Web Application 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # travis-heroku-java-example ---
[INFO] Deleting /home/ciuser/travis-heroku-java-example/target
[INFO]
[INFO] >>> heroku-maven-plugin:0.3.6:deploy-war (default-cli) # travis-heroku-java-example >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # travis-heroku-java-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/ciuser/travis-heroku-java-example/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # travis-heroku-java-example ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /home/ciuser/travis-heroku-java-example/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # travis-heroku-java-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/ciuser/travis-heroku-java-example/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # travis-heroku-java-example ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # travis-heroku-java-example ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # travis-heroku-java-example ---
[INFO] Packaging webapp
[INFO] Assembling webapp [travis-heroku-java-example] in [/home/ciuser/travis-heroku-java-example/target/travis-heroku-java-example]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/ciuser/travis-heroku-java-example/src/main/webapp]
[INFO] Webapp assembled in [38 msecs]
[INFO] Building war: /home/ciuser/travis-heroku-java-example/target/travis-heroku-java-example.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] <<< heroku-maven-plugin:0.3.6:deploy-war (default-cli) # travis-heroku-java-example <<<
[INFO]
[INFO] --- heroku-maven-plugin:0.3.6:deploy-war (default-cli) # travis-heroku-java-example ---
[INFO] Configured Artifact: com.github.jsimone:webapp-runner:7.0.57.2:jar
[INFO] Copying webapp-runner-7.0.57.2.jar to /home/ciuser/travis-heroku-java-example/target/dependency/webapp-runner.jar
[INFO] ---> Packaging application...
[INFO] - app: boiling-beach-1111
[INFO] - including: target/dependency/webapp-runner.jar
[INFO] - including: target/travis-heroku-java-example.war
[INFO] - installing: OpenJDK 1.8
[INFO] ---> Creating slug...
[INFO] - file: target/heroku/slug.tgz
[INFO] - size: 56MB
[INFO] ---> Uploading slug...
[INFO] - stack: cedar-14
[INFO] - process types: [web]
[INFO] ---> Releasing...
[INFO] - version: 6
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.265 s
[INFO] Finished at: 2015-04-24T20:05:46+00:00
[INFO] Final Memory: 19M/48M
[INFO] ------------------------------------------------------------------------
I'm facing a problem while trying to setup my webapp deployment to tomcat 7 using maven tomcat plugin.
settings.xml:
<server>
<id>server</id>
<username>admin</username>
<password>password</password>
</server>
pom.xml:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>server</server>
<url>http://localhost:8080/manager/text</url>
<path>/myapp</path>
</configuration>
</plugin>
When I'm starting to type mvn tom<tab> autocomplete suggests me only mvn tomcat:.
The output for mvn tomcat:list is:
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'tomcat'.
[INFO] ------------------------------------------------------------------------
[INFO] Building myapp
[INFO] task-segment: [tomcat:list]
[INFO] ------------------------------------------------------------------------
[INFO] [tomcat:list {execution: default-cli}]
[INFO] Listing applications at http://localhost:8080/manager
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot invoke Tomcat manager
Embedded error: http://localhost:8080/manager/list
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Sun Dec 22 21:37:08 MSK 2013
[INFO] Final Memory: 13M/211M
[INFO] ------------------------------------------------------------------------
It looks like that the tomcat6-maven-plugin is actually in use.
The output for mvn tomcat7:list is:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Required goal not found: tomcat7:list in org.apache.tomcat.maven:tomcat7-maven-plugin:2.2
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Sun Dec 22 21:43:41 MSK 2013
[INFO] Final Memory: 7M/116M
[INFO] ------------------------------------------------------------------------
I'm using Ubuntu 13.10, all software is installed via repository.
As far as I know , some goals are yet not available with the tomcat7 mojo and mvn tomcat7:list is one of them. mvn tomcat6:list is available for the tomcat6 mojo.