Maven not failing on compiler warnings - java

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>

Related

Getting blank surefire reports with "[WARNING] Unable to locate Test Source XRef to link to - DISABLED"

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

Java app deployment to heroku using Maven failed

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] ------------------------------------------------------------------------

Unable to see generated test source folder with mojo's build-helper

I have added the mojo's plugin build-helper to my project pom to generate a new test source folder for my integration tests. When I run the phase, generate-test-sources
mvn generate-test-sources
I could see the below console output showing the test source folder has generated, but When I look in project explorer, I don't see any folder which was created.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for *******
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.google.guava:guava:jar -> version 18.0 vs ${guava.version} # line 154, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.unitils:unitils-core:jar -> duplicate declaration of version 3.3 # line 164, column 21
[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 projectxxStaticAnalysisxxxxx versionxxxxx
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # StaticAnalysis ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # StaticAnalysis ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- build-helper-maven-plugin:1.9:add-test-source (add-integration-test-sources) # StaticAnalysis ---
[INFO] Test Source directory: C:\{workspacepath}\src\integration-test\java added.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.421 s
[INFO] Finished at: 2014-11-25T11:26:59-06:00
[INFO] Final Memory: 9M/303M
[INFO] ------------------------------------------------------------------------
Below is my pom plugin configuration
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9</version>
<executions>
<execution>
<id>add-integration-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/integration-test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Am I doing something wrong?. Please help.
Thanks
I think I found the answer to my question. I was actually expecting build-helper plugin to create the test folder for me. But the fact is, it won't create the folder for you.
You have to create the test folder and use this build-helper plugin to tell maven to treat the folder you created as test folder as shown in my pom above. I was able fix my issue by creating a new test folder and ran the following command
mvn generate-test-sources eclipse:eclipse
Hope this helps someone!

Maven cannot find tomcat7 goal while using tomcat7-maven-plugin

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.

Spring in Action: 3rd edition: Chapter 1...Maven and the POM file

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>

Categories