I'm developing a project containing different layers. I'm using Maven, JAX-WS, the Spring framework and Hibernate. I tried to generate the WSDL file using jax ws maven plugin. First I used a JRE 7 but it didn't work. When I used a JDK 1.7 this message appeared:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building BSCSwebservices Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for bsh:bsh:jar:1.2b3 is missing, no dependency information available
[WARNING] The POM for com.sun.xml.stream.buffer:streambuffer:jar:0.4 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.jvnet.staxex:stax-ex:jar:1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The artifact woodstox:wstx-asl:jar:3.2.0 has been relocated to org.codehaus.woodstox:wstx-asl:jar:3.2.0
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # BSCSwebservices ---
[debug] execute contextualize
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 6 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.1:compile (default-compile) # BSCSwebservices ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # BSCSwebservices ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\sayed\workspace\BSCSwebservices1\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.1:testCompile (default-testCompile) # BSCSwebservices ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # BSCSwebservices ---
[INFO] No tests to run.
[INFO] Surefire report directory: C:\Users\sayed\workspace\BSCSwebservices1\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) # BSCSwebservices ---
[INFO] Packaging webapp
[INFO] Assembling webapp [BSCSwebservices] in [C:\Users\sayed\workspace\BSCSwebservices1\target\BSCSwebservices]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\sayed\workspace\BSCSwebservices1\src\main\webapp]
[INFO] Webapp assembled in [607 msecs]
[INFO] Building war: C:\Users\sayed\workspace\BSCSwebservices1\target\BSCSwebservices.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO]
[INFO] --- jaxws-maven-plugin:1.11:wsgen (service_BillingAccountRead) # BSCSwebservices ---
[WARNING] The POM for woodstox:wstx-asl:jar:3.2.3 is missing, no dependency information available
warning: The apt tool and its associated API are planned to be
removed in the next major JDK release. These features have been
superseded by javac and the standardized annotation processing API,
javax.annotation.processing and javax.lang.model. Users are
recommended to migrate to the annotation processing features of
javac; see the javac man page for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.635s
[INFO] Finished at: Thu Aug 01 20:38:29 WAT 2013
[INFO] Final Memory: 16M/38M
[INFO] ------------------------------------------------------------------------
this a part of pom.xml
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.11</version>
<executions>
<execution>
<id>service_BillingAccountRead</id>
<phase>package</phase>
<goals>
<goal>wsgen</goal>
</goals>
<configuration>
<sei>com.ws.BillingAccountRead</sei>
<genwsdl>true</genwsdl>
<keep>true</keep>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
</plugin>
</plugins>
The build succeeds, but I don't find the WSDL file? And is that the warnings that have an effect after I completed the other layer?
I added the dependency of all all jars appearing in warnings, but the warnings are still shown.
WSDL's get placed by default in {module_root}\target\generated-sources\wsdl
You REALLY need to start including relevant info in your questions. You haven't even posted the relevant parts of your pom. Have you even told jax-ws to generate a wsdl?
Also, fix the tonne of warnings getting spat out when you run your maven build. That just adds to the mess of info you are posting.
EDIT:
Go look up the documentation. You can explicitly state where the wsdls will end up. All of your questions have had simple answers which you could have found yourself with a minimal amount of effort on your part.
Generally, when you build the project, the WSDL document file and the schema document files are not generated automatically. This files are generated on deploy time by the application server. Internally, the server executes the wsgen tool to generate the files. Next, when you request the WSLD document file (add ?wsdl on service endpoint) the application server on the fly update the service url in the files and serves.
If you want include the generation of this files, you can add in your pom.xml the JAX-WS commons. See an example in this question.
Related
I am using IntelliJ IDE. My project is maven project. What is bothering me is that when for example choose "Install" phase from Maven Toolbar and click "Run Maven Build",
the clean phase is not executed:
"C:\Program Files\Java\jdk-9.0.1\bin\java" -Dmaven.multiModuleProjectDirectory=A:\custom_software_projects\IdeaProjects\power_management "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2\lib\idea_rt.jar=53577:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2017.3.2 install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building power_server 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # power_server ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # power_server ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # power_server ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory A:\custom_software_projects\IdeaProjects\power_management\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # power_server ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # power_server ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # power_server ---
[INFO]
[INFO] --- maven-assembly-plugin:2.2-beta-5:single (default) # power_server ---
[INFO] Building jar: A:\custom_software_projects\IdeaProjects\power_management\target\power_server-1.0-SNAPSHOT-jar-with-dependencies.jar
[INFO]
[INFO] --- maven-dependency-plugin:3.0.2:unpack-dependencies (unpack-sigar) # power_server ---
[INFO] log4j:log4j:jar:1.2.17 already exists in destination.
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # power_server ---
[INFO] Installing A:\custom_software_projects\IdeaProjects\power_management\target\power_server-1.0-SNAPSHOT.jar to C:\Users\ggeorgiev\.m2\repository\Power_Management_Server\power_server\1.0-SNAPSHOT\power_server-1.0-SNAPSHOT.jar
[INFO] Installing A:\custom_software_projects\IdeaProjects\power_management\pom.xml to C:\Users\ggeorgiev\.m2\repository\Power_Management_Server\power_server\1.0-SNAPSHOT\power_server-1.0-SNAPSHOT.pom
[INFO] Installing A:\custom_software_projects\IdeaProjects\power_management\target\power_server-1.0-SNAPSHOT-jar-with-dependencies.jar to C:\Users\ggeorgiev\.m2\repository\Power_Management_Server\power_server\1.0-SNAPSHOT\power_server-1.0-SNAPSHOT-jar-with-dependencies.jar
[INFO]
[INFO] --- maven-antrun-plugin:1.4:run (Copying jar-with-dependecnies and fixing LF in .sh scripts) # power_server ---
project.artifactId
[INFO] Executing tasks
[copy] Copying 1 file to A:\custom_programs\power_server
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.291 s
[INFO] Finished at: 2018-02-10T21:42:17+02:00
[INFO] Final Memory: 17M/56M
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
So, as you see the first step taken is maven-resources-plugin:2.6:resources. From what I understood from maven docs is that when we specify a phase all previous phases are executed up to the chosen one. Per maven doc:
This command executes each default life cycle phase in order (validate, compile, package, etc.), before executing install. You only need to call the last build phase to be executed, in this case, install
Why is it skipping the clean and validate phases?
Edit:
I also have the clean phase in the Run Configuration section, but the result is the same:
Maven has 3 different builtin lifecycles
There are three built-in build lifecycles: default, clean and site.
install is part of the default lifecycle and there is no reason for clean to execute when you do install.
As to validate it has no built in binding as you can see here which means that it's not going to execute:
Furthermore, a build phase can also have zero or more goals bound to it. If a build phase has no goals bound to it, that build phase will not execute.
The default lifecycle does not include clean in it. Check the docs
Quote:
For example, the default lifecycle comprises of the following phases
(for a complete list of the lifecycle phases, refer to the Lifecycle
Reference):
validate - validate the project is correct and all necessary
information is available
compile - compile the source code of the
project
test - test the compiled source code using a suitable unit
testing framework. These tests should not require the code be packaged
or deployed
package - take the compiled code and package it in its
distributable format, such as a JAR.
verify - run any checks on
results of integration tests to ensure quality criteria are met
install - install the package into the local repository, for use as a
dependency in other projects locally
deploy - done in the build
environment, copies the final package to the remote repository for
sharing with other developers and projects.
Also, the validate phase is not associated with the default lifecycle of packaging .jar files.
Check the Default Lifecycle Bindings for JAR files at the bottom of the docs
,
Spark code compile operation fails on few machines whereas the same source code passes on few other machines.
Please check the error on Centos (4.10.12-1.el7.elrepo.x86_64)
./build/mvn -X -DskipTests -Dscala.lib.directory=/usr/share/scala -pl core compile
INFO] Building Spark Project Core 2.2.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.spark:spark-launcher_2.11:jar:2.2.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.spark:spark-network-common_2.11:jar:2.2.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.spark:spark-network-shuffle_2.11:jar:2.2.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.spark:spark-unsafe_2.11:jar:2.2.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.spark:spark-tags_2.11:jar:2.2.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.spark:spark-tags_2.11:jar:tests:2.2.2-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.804 s
[INFO] Finished at: 2017-12-04T23:18:58-08:00
[INFO] Final Memory: 43M/1963M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project spark-core_2.11: Could not resolve dependencies for project org.apache.spark:spark-core_2.11:jar:2.2.2-SNAPSHOT: The following artifacts could not be resolved: org.apache.spark:spark-launcher_2.11:jar:2.2.2-SNAPSHOT, org.apache.spark:spark-network-common_2.11:jar:2.2.2-SNAPSHOT, org.apache.spark:spark-network-shuffle_2.11:jar:2.2.2-SNAPSHOT, org.apache.spark:spark-unsafe_2.11:jar:2.2.2-SNAPSHOT, org.apache.spark:spark-tags_2.11:jar:2.2.2-SNAPSHOT, org.apache.spark:spark-tags_2.11:jar:tests:2.2.2-SNAPSHOT: Failure to find org.apache.spark:spark-launcher_2.11:jar:2.2.2-SNAPSHOT in http://artifact.eng.stellus.in:8081/artifactory/libs-snapshot was cached in the local repository, resolution will not be reattempted until the update interval of snapshots has elapsed or updates are forced -> [Help 1]
Note: The same source code passes on another CentOS machine(3.10.0-514.el7.x86_64)
./build/mvn -DskipTests -Dscala.lib.directory=/usr/share/scala -pl core compile
[INFO] — maven-compiler-plugin:3.7.0:compile (default-compile) # spark-core_2.11 —
[INFO] Not compiling main sources
[INFO]
[INFO] — scala-maven-plugin:3.2.2:compile (scala-compile-first) # spark-core_2.11 —
[INFO] Using zinc server for incremental compilation
[info] Compile success at Dec 4, 2017 11:17:34 PM [0.331s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.663 s
[INFO] Finished at: 2017-12-04T23:17:34-08:00
[INFO] Final Memory: 52M/1297M
[INFO] ------------------------------------------------------------------------
If the build works only in specific machine it means that you already have the missing dependency on your .m2 local repository.
If you will remove all your directories under .m2 (on the centos machine) the build will fail.
You should add all your missing dependencies.
[WARNING] The POM for org.apache.spark:spark-launcher_2.11:jar:2.2.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.spark:spark-network-common_2.11:jar:2.2.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.spark:spark-network-shuffle_2.11:jar:2.2.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.spark:spark-unsafe_2.11:jar:2.2.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.spark:spark-tags_2.11:jar:2.2.2-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.apache.spark:spark-tags_2.11:jar:tests:2.2.2-SNAPSHOT is missing, no dependency information available
The following patch fix the compilation bug
diff --git a/pom.xml b/pom.xml
index cc48ee794e..ef0b01bec8 100644
--- a/pom.xml
+++ b/pom.xml
## -2518,6 +2518,13 ##
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
See here stackoverflow.com/questions/4786881
why is "test-jar" dependency required for "mvn compile"
Another possibility:
you have a maven profile that does <maven.test.skip>true</maven.test.skip> (which skips both test compilation and execution)
instead of
<skipTests>true</skipTests>
(which skip execution, but compiles test)
I can't understand why maven-surefire-plugin doesn't run jUnit4 test. My pom is (can't add it here because "it looks post is mostly code"): http://pastebin.com/Jj3iJZpY
When I execute mvn clean test cmd window shows:
C:\Users\maya\git\services>mvn clean test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building services 1.0.18
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # services ---
[INFO] Deleting C:\Users\maya\git\services\target
[INFO]
[INFO] --- maven-mule-plugin:1.9:attach-test-resources (default-attach-test-resources) # services ---
[INFO] attaching test resource C:\Users\maya\git\services\src\main\app
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:add-resource (add-resource) # services ---
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) # services ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 3 resources
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-mule-plugin:1.9:filter-resources (default-filter-resources) # services ---
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # services ---
[INFO] Compiling 60 source files to C:\Users\maya\git\services\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) # services ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # services ---
[INFO] Compiling 1 source file to C:\Users\maya\git\services\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.19:test (default-test) # services ---
[INFO]
[INFO] --- maven-surefire-plugin:2.19:test (default) # services ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.554 s
[INFO] Finished at: 2015-12-11T15:48:05+03:00
[INFO] Final Memory: 48M/312M
[INFO] ------------------------------------------------------------------------
Test class is:
package com.comp.utils.UtilsTest;
import static org.junit.Assert.assertTrue;
import org.apache.log4j.Logger;
import org.junit.Test;
public class UtilsTest {
private static final Logger LOG = Logger.getLogger(UtilsTest.class.getName());
#Test
public void testHasPersonSameProd() {
boolean hasSameProduct = false;
assertTrue("Should be True", hasSameProduct);
}
}
Why maven-surefire-plugin:2.19 runs twice and doesn't want to run my test class? How to run test in my case? Thank you.
Given the pom you linked (which should be included into the question actually, as the link may be broken in the future):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.19</version>
</dependency>
</dependencies>
<configuration>
<includes>
<include>UtilTest.java</include>
</includes>
</configuration>
</plugin>
The Maven Surefire Plugin runs twice because you configured an additional execution of the plugin, without providing an id element and as such by default it is called default (maven-surefire-plugin:2.19:test (default)). This execution runs after the out-of-the-box Maven configuration for Surefire (maven-surefire-plugin:2.19:test (default-test)). So, as a consequence, you have two executions (default and default-test). Removing the executions section on the Surefire plugin configuration you would only have one execution (the default-test).
You also have a typo in the Surefire configuration, the <include>UtilTest.java</include> configuration points to the UtilTest.java class, while in your question it is named UtilsTest (note the additional 's').
If the test class is under src/test/java folder, then you don't need to configure its inclusion, since it also already follow the default convention of Surefire, "**/*Test.java".
The message you are having (Skipping execution of surefire because it has already been run for this configuration) is because your configuration element for the Surefire plugin is outside any executions element, which means is applied to all plugin executions, even the default one (default-test).
So you could probably remove the whole Surefire plugin section from your pom and the issue should be fixed.
I have maven project where my driver script is testng test and when i ran the test with testng suite it works perfect.
But when i ran the test with pom.xml or jenkins it is always complaining saying it is pointing to lower version though i configured the JRE and Compiler to latest version in Eclipse.
How to overcome this issue:
Following is jenkins logs:
Started by user anonymous
Building in workspace C:\Users\Uday\.jenkins\workspace\MavenProj
FSSCM.checkout D:\FrameworkDemos\MavenHAF to C:\Users\Uday\.jenkins\workspace\MavenProj
FSSCM.check completed in 62 milliseconds
Parsing POMs
Discovered a new module MavenWebHAF:MavenWebHAF MavenWebHAF
Modules changed, recalculating dependency graph
[MavenProj] $ "C:\Program Files\Java\jdk1.8.0_60/bin/java" -cp C:\Users\Uday\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-agent-1.5.jar;E:\Softwares\apache-maven-3.3.3\boot\plexus-classworlds-2.5.2.jar;E:\Softwares\apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven31Main E:\Softwares\apache-maven-3.3.3 C:\Users\Uday\.jenkins\war\WEB-INF\lib\remoting-2.52.jar C:\Users\Uday\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-interceptor-1.5.jar C:\Users\Uday\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.5.jar 52877
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f C:\Users\Uday\.jenkins\workspace\MavenProj\pom.xml test -Dtest=TestSuite.TestAutomationDriver
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for MavenWebHAF:MavenWebHAF:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.relevantcodes:extentreports:jar should use a variable instead of a hard-coded path E:\Programming Samples\Selenium Jars\extentreports_Updated.jar # line 33, column 21
[WARNING] 'dependencies.dependency.systemPath' for org.monte:media:jar should use a variable instead of a hard-coded path E:\Programming Samples\Selenium Jars\MonteScreenRecorder.jar # line 40, column 21
[WARNING] 'dependencies.dependency.systemPath' for com.sun:tools:jar should use a variable instead of a hard-coded path C:\Program Files\Java\jdk1.8.0_60\lib\tools.jar # line 52, column 29
[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 MavenWebHAF 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # MavenWebHAF ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Uday\.jenkins\workspace\MavenProj\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # MavenWebHAF ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # MavenWebHAF ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Uday\.jenkins\workspace\MavenProj\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # MavenWebHAF ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 7 source files to C:\Users\Uday\.jenkins\workspace\MavenProj\target\test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[244,39] strings in switch are not supported in -source 1.5
(use -source 7 or higher to enable strings in switch)
[ERROR] /C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[287,39] strings in switch are not supported in -source 1.5
(use -source 7 or higher to enable strings in switch)
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.643 s
[INFO] Finished at: 2015-09-29T23:47:29+05:30
[INFO] Final Memory: 24M/273M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving C:\Users\Uday\.jenkins\workspace\MavenProj\pom.xml to MavenWebHAF/MavenWebHAF/0.0.1-SNAPSHOT/MavenWebHAF-0.0.1-SNAPSHOT.pom
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project MavenWebHAF: Compilation failure: Compilation failure:
[ERROR] /C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[244,39] strings in switch are not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable strings in switch)
[ERROR] /C:/Users/Uday/.jenkins/workspace/MavenProj/src/test/java/FrameworkLibraries/FunctionLibraries/CommonFunctionLibrary.java:[287,39] strings in switch are not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable strings in switch)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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
channel stopped
Finished: FAILURE
Maven always uses default Java installation. Judging by the errors you posted the Java version on your system is something other than Java 7 ( < Java v7). I don't know if you have multiple Java versions installed but you might resolve this problem in one of the two ways:
upgrade Java version
tell Maven which Java version you need to use explicitly by specifying Maven compiler plugin with desired Java version. Take a look into Maven plugin management - https://maven.apache.org/pom.html#Plugin_Management
Here is the sample of such configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
Hope this helps.
Open your pom and see whether you have configured an older Java version for source version in maven compiler plugin configuration.
If so, setting it to a newer version will fix the problem. For example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
I am trying to deploy and run my webapplication using maven and its tomcat plugin.
I have set it up in project's pom.xml, but when I'm calling it from command line:
mvn tomcat:run
all that I get is:
[root#ovz6022 trunk]# mvn -e tomcat:run
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.gotbrains.breeze:breeze:jar:1.0
[INFO] task-segment: [tomcat:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing tomcat:run
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /root/trunk/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [tomcat:run {execution: default-cli}]
[INFO] Skipping non-war project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24 seconds
[INFO] Finished at: Thu Jul 23 14:34:31 MDT 2009
[INFO] Final Memory: 7M/14M
[INFO] ------------------------------------------------------------------------
And that's all. Tomcat hasn't been launched but I don't see any errors here.
Does anybody knows what's happening?
As mentioned before, you should use war packaging. However, if you can't because you're using OSGI or some other reason, you can tell the Tomcat plugin to deploy anyway even if it isn't war packaging by using the ignorePackaging option:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<ignorePackaging>true</ignorePackaging>
The clue is in the line:
[INFO] Skipping non-war project
The tomcat:run goal is intended to work with war projects, I'm guessing yours is a jar project.
You need to change the packaging of your project to war, you may also need to provide some additional configuration for the war to actually do anything.
Note: I'd recommend having a separate war project to your jar projects, then adding the jars as dependencies to the war.
if you're using Roo, and haven't yet invoked the controller command then your configuration is not yet set to generate a WAR file.