Pom dependency front end - ejb client - maven

Hi i'm a junior developer and i'm working on this project, like the title i can't link my ejb-client with the front-end (also back-end) is my first solo project, i wrote everything but i have some problems with the poms, on the foot of the topic there's the detailed maven error (sorry for format my first thread here)
Ejb Client Pom
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>progettoaziende-ejb-client</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>progettoaziende-ejb-client</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-core</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ejb-client-bom</artifactId>
<version>7.1.1.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Front End pom.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>progettoaziende-frontend</artifactId>
<packaging>war</packaging>
<name>progetto aziende-frontend</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<finalName>progettoaziende-frontend</finalName>
</build>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-core</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-taglib</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-extras</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.2.0.GA</version>
<scope>provided</scope>
</dependency>
<!-- Json Mapping -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>2.2.0.GA</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
</dependencies>
</project>
SUPER POM
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ProgettoAziende</name>
<url>http://maven.apache.org</url>
<modules>
<module>progettoaziende-be-ear</module>
<module>progettoaziende-ejb-client</module>
<module>progettoaziende-be-ejb</module>
<module>progettoaziende-frontend</module>
</modules>
<properties>
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ear</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ejb</artifactId>
<type>ejb</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-frontend</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
EJB Module
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>progettoaziende-be-ejb</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-core</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<type>ejb-client</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-sqlmap</artifactId>
<version>2.3.4.726</version>
</dependency>
</dependencies>
</project>
MAVEN ERROR (I tried to compile the back-end module here, but is the same kind of problem with the front end, same error)
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building progettoaziende-be-ejb 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.422 s
[INFO] Finished at: 2016-04-19T14:33:24+02:00
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project progettoaziende-be-ejb: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT -> [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/DependencyResolutionException
EDIT: FULL ERROR TRACE
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ProgettoAziende
[INFO] progettoaziende-ejb-client
[INFO] progettoaziende-be-ejb
[INFO] progetto aziende-frontend
[INFO] progettoaziende-be-ear
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ProgettoAziende 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # ProgettoAziende ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # ProgettoAziende ---
[INFO] Installing C:\Users\DEV\workspace\ProgettoAziende\pom.xml to C:\Users\DEV\.m2\repository\it\isc\ProgettoAziende\0.0.1-SNAPSHOT\ProgettoAziende-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building progettoaziende-ejb-client 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # progettoaziende-ejb-client ---
[INFO] Deleting C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # progettoaziende-ejb-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # progettoaziende-ejb-client ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # progettoaziende-ejb-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # progettoaziende-ejb-client ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # progettoaziende-ejb-client ---
[INFO] Surefire report directory: C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.progettoaziende.ejb.client.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # progettoaziende-ejb-client ---
[INFO] Building jar: C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\progettoaziende-ejb-client-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # progettoaziende-ejb-client ---
[INFO] Installing C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\progettoaziende-ejb-client-0.0.1-SNAPSHOT.jar to C:\Users\DEV\.m2\repository\it\isc\progettoaziende-ejb-client\0.0.1-SNAPSHOT\progettoaziende-ejb-client-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\pom.xml to C:\Users\DEV\.m2\repository\it\isc\progettoaziende-ejb-client\0.0.1-SNAPSHOT\progettoaziende-ejb-client-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building progettoaziende-be-ejb 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] ProgettoAziende .................................... SUCCESS [ 1.584 s]
[INFO] progettoaziende-ejb-client ......................... SUCCESS [ 9.071 s]
[INFO] progettoaziende-be-ejb ............................. FAILURE [ 0.160 s]
[INFO] progetto aziende-frontend .......................... SKIPPED
[INFO] progettoaziende-be-ear ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.579 s
[INFO] Finished at: 2016-04-20T09:40:23+02:00
[INFO] Final Memory: 12M/28M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project progettoaziende-be-ejb: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project progettoaziende-be-ejb: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:257)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
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:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
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:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:211)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
... 23 more
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:384)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:205)
... 24 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367)
... 25 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:434)
... 27 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/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :progettoaziende-be-ejb

So, I'm assuming you're using the progettoaziende-ejb-client module as container for your EJB API interfaces, in order to share with both your progettoaziende-frontend and progettoaziende-be-ejb modules.
As you probably already figured out, you're not generating your EJB client correctly.
Instead of having two modules, progettoaziende-be-ejb and progettoaziende-ejb-client, you should only have one module: progettoaziende-be-ejb.
Then, on the pom.xml of this module, you'd say it is an EJB module and configure your Maven EJB Plugin in order to generate an EJB client:
<artifactId>progettoaziende-be-ejb</artifactId>
<packaging>ejb</packaging>
(...)
<build>
(...)
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
(...)
<generateClient>true</generateClient>
(...)
</configuration>
</plugin>
</plugins>
(...)
</build>
Afterwards, in order to specify what your EJB client jar should or shouldn't contain, you could make use of the clientIncludes and clientExcludes elements:
<build>
(...)
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
(...)
<generateClient>true</generateClient>
<clientIncludes>
<!-- this will include all files and directories under com/foo/bar -->
<clientInclude>com/foo/bar/**</clientInclude>
<!-- this will include all files and directories under com/foo/acme -->
<clientInclude>com/foo/acme/**</clientInclude>
<!-- this will include all files under com/example -->
<clientInclude>com/example/*</clientInclude>
</clientIncludes>
<clientExcludes>
<!-- this will exclude all files under com/example -->
<clientExclude>com/example/*</clientExclude>
<!-- this will exclude all files and directories with the name
sparrow under com/jack -->
<clientExclude>com/jack/**/sparrow</clientExclude>
</clientExcludes>
</configuration>
</plugin>
</plugins>
(...)
</build>
Finally, you should:
Remove the dependency progettoaziende-ejb-client from the pom.xml of progettoaziende-be-ejb module;
Modify the dependency progettoaziende-ejb-client on the pom.xml of your WAR module from:
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
to:
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>ejb-client</type>
</dependency>

Related

Maven tests are running well locally (OSX) but not running at all on remove CI machine

I have some Maven tests suite using Junit 4.12, that running well using 'mvn test' locally on my Mac, but not running at all on remote CI machine:
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # AndroidAutomationTests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/circleci/project/AndroidAutomaticTests/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # AndroidAutomationTests ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # AndroidAutomationTests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/circleci/project/AndroidAutomaticTests/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # AndroidAutomationTests ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) # AndroidAutomationTests ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.619 s
[INFO] Finished at: 2019-10-17T07:33:04Z
[INFO] ------------------------------------------------------------------------
Here is the POM.xml:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
<systemPropertyVariables>
<browserStack>0</browserStack>
<jenkins>0</jenkins>
<kobiton>0</kobiton>
<bs>null</bs>
<buildDirectory>${project.build.directory}</buildDirectory>
<appPath>k</appPath>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<groupId>GlucoMe</groupId>
<artifactId>AndroidAutomationTests</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-path</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20171018</version>
</dependency>
</dependencies>
</project>
Both Maven versions are 3.6.0, and it's exactly the same project and branch.
Any idea?
Also, all tests name ends with "Test" and so are the tests classes.
Thanks!

Maven compiles old servlet dependency

For some reason Maven is compiling old servlet dependency instead of the new one. I've tried to clean up cache using:
mvn dependency:purge-local-repository -DreResolve=false
and
mvn dependency:resolve
And that's what logs gave me:
[INFO]
[INFO] --- maven-dependency-plugin:2.8:resolve (default-cli) # examproject ---
[INFO]
[INFO] The following files have been resolved:
[INFO] com.google.cloud:google-cloud-core-http:jar:1.84.0:compile
[INFO] com.google.cloud.datastore:datastore-v1-proto-client:jar:1.6.0:compile
[INFO] org.threeten:threetenbp:jar:1.3.3:compile
[INFO] com.google.protobuf:protobuf-java:jar:3.7.1:compile
[INFO] io.grpc:grpc-core:jar:1.21.0:compile
[INFO] com.google.appengine.tools:appengine-gcs-client:jar:0.7:compile
[INFO] joda-time:joda-time:jar:2.3:compile
[INFO] javax.transaction:transaction-api:jar:1.1:compile
[INFO] com.google.api.grpc:proto-google-common-protos:jar:1.16.0:compile
[INFO] jstl:jstl:jar:1.2:compile
[INFO] com.google.oauth-client:google-oauth-client-appengine:jar:1.30.1:compile
[INFO] com.fasterxml.jackson.core:jackson-core:jar:2.9.9:compile
[INFO] com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
[INFO] io.grpc:grpc-context:jar:1.19.0:compile
[INFO] com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] com.google.api:gax-httpjson:jar:0.64.1:compile
[INFO] javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] com.google.appengine:appengine-api-1.0-sdk:jar:1.9.76:compile
[INFO] com.google.http-client:google-http-client-jackson:jar:1.20.0:compile
[INFO] io.opencensus:opencensus-contrib-grpc-metrics:jar:0.21.0:compile
[INFO] org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] com.google.code.gson:gson:jar:2.8.5:provided
[INFO] com.google.api.grpc:proto-google-iam-v1:jar:0.12.0:compile
[INFO] com.google.auth:google-auth-library-oauth2-http:jar:0.16.2:compile
[INFO] commons-logging:commons-logging:jar:1.2:compile
[INFO] com.google.cloud:google-cloud-datastore:jar:1.84.0:compile
[INFO] com.google.errorprone:error_prone_annotations:jar:2.3.2:compile
[INFO] com.google.http-client:google-http-client:jar:1.31.0:compile
[INFO] commons-codec:commons-codec:jar:1.11:compile
[INFO] com.google.http-client:google-http-client-jackson2:jar:1.31.0:compile
[INFO] com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] net.spy:spymemcached:jar:2.12.3:compile
[INFO] com.google.api:api-common:jar:1.8.1:compile
[INFO] com.google.guava:guava:jar:19.0:compile
[INFO] io.opencensus:opencensus-contrib-http-util:jar:0.21.0:compile
[INFO] com.google.http-client:google-http-client-protobuf:jar:1.20.0:compile
[INFO] com.google.oauth-client:google-oauth-client-servlet:jar:1.30.1:compile
[INFO] io.opencensus:opencensus-api:jar:0.21.0:compile
[INFO] com.google.api-client:google-api-client-servlet:jar:1.30.2:compile
[INFO] com.google.apis:google-api-services-storage:jar:v1-rev108-1.22.0:compile
[INFO] com.google.api.grpc:proto-google-cloud-datastore-v1:jar:0.67.0:compile
[INFO] com.google.http-client:google-http-client-appengine:jar:1.30.1:compile
[INFO] javax.servlet.jsp:javax.servlet.jsp-api:jar:2.3.1:provided
[INFO] io.grpc:grpc-api:jar:1.21.0:compile
[INFO] com.google.oauth-client:google-oauth-client:jar:1.22.0:compile
[INFO] org.apache.httpcomponents:httpclient:jar:4.5.9:compile
[INFO] com.google.cloud:google-cloud-core:jar:1.84.0:compile
[INFO] com.google.api-client:google-api-client-appengine:jar:1.30.2:compile
[INFO] org.apache.httpcomponents:httpcore:jar:4.4.11:compile
[INFO] com.google.protobuf:protobuf-java-util:jar:3.7.1:compile
[INFO] javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] com.google.api:gax:jar:1.47.1:compile
[INFO] com.google.auth:google-auth-library-credentials:jar:0.16.2:compile
[INFO] com.google.android:annotations:jar:4.1.1.4:compile
[INFO] junit:junit:jar:4.12:test
[INFO] javax.jdo:jdo2-api:jar:2.3-eb:compile
[INFO] org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] javax.servlet:servlet-api:jar:2.5:compile
[INFO] com.googlecode.objectify:objectify:jar:6.0.4:compile
[INFO] org.codehaus.jackson:jackson-core-asl:jar:1.9.11:compile
[INFO] com.google.api-client:google-api-client:jar:1.22.0:compile
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.139 s
[INFO] Finished at: 2019-08-12T10:51:40+02:00
[INFO] ------------------------------------------------------------------------
As you can see 3.1.0 is provided, but for some reason 2.5 is the one compiled. This is my POM, it is mostly pre-compiled and I've added few dependencies:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
<packaging>war</packaging>
<version>0.1.0-SNAPSHOT</version>
<groupId>examproject</groupId>
<artifactId>examproject</artifactId>
<properties>
<appengine.maven.plugin.version>2.1.0</appengine.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bom</artifactId>
<version>0.102.0-alpha</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.7</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>provided</scope>
</dependency>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.76</version>
</dependency>
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>6.0.4</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<!-- appengine-maven-plugin requires Maven 3.5.0 -->
<requireMavenVersion>
<version>3.5.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
In order to do a couple of things (Using getPart method and something else) I need 3.1.0 servlet.
UPDATE:
If I try to delete C:\Users\Gabriel.m2\repository\javax\servlet\servlet-api, It recreates the folder after I update the project. For some reason Maven is clearly using 2.5 servlet instead of 3.1.0 and I can't understand why.
This is the answer of Gabriel Costache, which I copy/pasted from the question:
I manged to solve it, I'm posting what I've done if someone will ever need it.
Basically, appengine-gcs-client artifact compiles by his own servlet 2.5.
If you have a similar issue, run
mvn dependency:tree
and find from where your dependency is compiled, than add an exclusion tag just like this
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.7</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>

UnsupportedClassVersionError Unsupported major.minor version 52.0 (unable to load class )

The same war file when deployed on my machine works fine. However on ubuntu 14. and jdk 1.8 on remote server, I keep getting an exception when I deploy it to tomcat using maven.
I checked the jdk listed on the remote server:
root#li1242-163:~# sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1072 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
* 2 /usr/lib/jvm/java-8-oracle/jre/bin/java 1072 manual mode
This is the java version on the remote serveR:
root#li1242-163:~# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
May 26, 2015 12:10:27 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet crudservlet
java.lang.UnsupportedClassVersionError: crudapproot/EntityResource : Unsupported major.minor version 52.0 (unable to load class crudapproot.EntityResource)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2948)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.glassfish.jersey.internal.util.ReflectionHelper$7.run(ReflectionHelper.java:402)
at org.glassfish.jersey.internal.util.ReflectionHelper$7.run(ReflectionHelper.java:397)
at java.security.AccessController.doPrivileged(Native Method)
at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener$AnnotatedClassVisitor.getClassForName(AnnotationAcceptingListener.java:262)
at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener$AnnotatedClassVisitor.visitEnd(AnnotationAcceptingListener.java:224)
at jersey.repackaged.org.objectweb.asm.ClassReader.accept(ClassReader.java:697)
at jersey.repackaged.org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.process(AnnotationAcceptingListener.java:170)
at org.glassfish.jersey.server.ResourceConfig.scanClasses(ResourceConfig.java:899)
at org.glassfish.jersey.server.ResourceConfig._getClasses(ResourceConfig.java:856)
at org.glassfish.jersey.server.ResourceConfig.getClasses(ResourceConfig.java:762)
at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.<init>(ResourceConfig.java:1190)
at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.<init>(ResourceConfig.java:1162)
at org.glassfish.jersey.server.ResourceConfig.createRuntimeConfig(ResourceConfig.java:1158)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:322)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:338)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:171)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:363)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1279)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1192)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
I am deploying a webapplication using maven to a remote server, the pom file is configured as follows:
<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>OrbithubWeb</groupId>
<artifactId>OrbithubWeb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<!-- customize the catalina_home for remote deployment
for tomcat7, the remotedeployserverurl is http://localhost:8080/manager/text
and for tomcat6 http://localhost:8080/manager/html
-->
<properties>
<java-version>1.7</java-version>
<org.springframework-version>4.0.3.RELEASE</org.springframework-version>
<warfilename>${project.groupId}</warfilename>
<!-- change the url to : http://45.79.143.163:8080/manager/text -->
<remotedeployserverurl>http://localhost:8080/manager/text</remotedeployserverurl>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework-version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- spring framework just added ends here -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<!-- jersey dependencies ends -->
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
<!-- jersey dependency ends -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- used for httpclient library -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version>
</dependency>
<!-- adding for log4j dependency for logging -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- Added 25 May: added the dependecy for Jax-RS 2.0 jersey core Servlet 3.x implementation -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.17</version>
</dependency>
<!-- Added 25 May: for jersey-client implementation -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.17</version>
</dependency>
<!-- dependency resolved for jax-rs -->
<!-- Uses this dependency to read from build.properties file. The artifact id # properties-maven-plugin -->
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- changes the default location of war deployment -->
<!-- commented it since we are directly deploying war to the ${catalina_home}/webapps -->
<!-- <warName>${warfilename}</warName> -->
<!-- <outputDirectory>${catalina_home}/webapps</outputDirectory> -->
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- added to deploy maven build to remote tomcat, update = true :: redeploy's the war files on update -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>${remotedeployserverurl}</url>
<server>tomcat7</server>
<path>/${project.groupId}</path>
<!-- configuring the tomcat7 to update itself while deploying -->
<update>true</update>
<!-- added this on 25 April -->
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<!-- Associate the read-project-properties goal with the initialize phase, to read the properties file. -->
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<!-- taking the build.properties from the relative location of the pom file -->
<file>build.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
A snapshot of the deployment for war file on tomcat is :
root#li1242-163:~/OrbitHub-Java-Rest-API# mvn clean tomcat7:deploy
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OrbithubWeb 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # OrbithubWeb ---
[INFO] Deleting /root/OrbitHub-Java-Rest-API/target
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) # OrbithubWeb >>>
[INFO]
[INFO] --- properties-maven-plugin:1.0-alpha-2:read-project-properties (default) # OrbithubWeb ---
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) # OrbithubWeb ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # OrbithubWeb ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 19 source files to /root/OrbitHub-Java-Rest-API/target/classes
[WARNING] /root/OrbitHub-Java-Rest-API/src/test/TestCallToWebapp.java: /root/OrbitHub-Java-Rest-API/src/test/TestCallToWebapp.java uses or overrides a deprecated API.
[WARNING] /root/OrbitHub-Java-Rest-API/src/test/TestCallToWebapp.java: Recompile with -Xlint:deprecation for details.
[WARNING] /root/OrbitHub-Java-Rest-API/src/asyncrequesthandlr/ControllableExecutors.java: /root/OrbitHub-Java-Rest-API/src/asyncrequesthandlr/ControllableExecutors.java uses unchecked or unsafe operations.
[WARNING] /root/OrbitHub-Java-Rest-API/src/asyncrequesthandlr/ControllableExecutors.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) # OrbithubWeb ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /root/OrbitHub-Java-Rest-API/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # OrbithubWeb ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # OrbithubWeb ---
[INFO] No tests to run.
[INFO] Surefire report directory: /root/OrbitHub-Java-Rest-API/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) # OrbithubWeb ---
[INFO] Packaging webapp
[INFO] Assembling webapp [OrbithubWeb] in [/root/OrbitHub-Java-Rest-API/target/OrbithubWeb-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/root/OrbitHub-Java-Rest-API/WebContent]
[INFO] Webapp assembled in [202 msecs]
[INFO] Building war: /root/OrbitHub-Java-Rest-API/target/OrbithubWeb-0.0.1-SNAPSHOT.war
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) # OrbithubWeb <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) # OrbithubWeb ---
[INFO] Deploying war to http://45.79.143.163:8080/OrbithubWeb
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.
Uploading: http://45.79.143.163:8080/manager/text/deploy?path=%2FOrbithubWeb&update=true
Uploaded: http://45.79.143.163:8080/manager/text/deploy?path=%2FOrbithubWeb&update=true (12330 KB at 20279.0 KB/sec)
[INFO] tomcatManager status code:200, ReasonPhrase:OK
[INFO] OK - Deployed application at context path /OrbithubWeb
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.924s
[INFO] Finished at: Tue May 26 00:00:28 UTC 2015
[INFO] Final Memory: 22M/54M
[INFO] ------------------------------------------------------------------------
This worked for me , I found a tutorial for the same here: https://askubuntu.com/questions/121654/how-to-set-default-java-version
:
Made changes to the JAVA_HOME variable : vi /etc/default/tomcat7
java8 was found here:
/usr/lib/jvm/java-8-oracle/bin/
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-8-oracle/bin/javac" 1
sudo update-alternatives --config javac
To check the jvm that the tomcat is using :
ps -ef | grep tomcat
Also, curl http://admin:admin#localhost:8080/manager/text/serverinfo

Maven won't run tests

When running mvn test maven won't run all Test Classes.
When I explicitly provide a class by adding -Dtest=PropertyTests the tests will be run.
Here's my pom.xml:
<configuration>
<includes>
<include>**/*Spec.*</include>
<include>**/*Test.*</include>
</includes>
</configuration>
<?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>example</artifactId>
<version>1.0</version>
<properties>
<java-version>1.6</java-version>
<org.slf4j-version>1.6.6</org.slf4j-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>runtime</scope>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Why maven won't run the tests automatically? Did I missed something?
Example test (Class is in src/test/java/com/example/PropertyTests.java):
public final class PropertyTests
{
#Test
public void testGetters()
{
Property property = new Property( "foo", "bar" );
Assert.assertEquals( "foo", property.getKey() );
Assert.assertEquals( "bar", property.getValue() );
}
}
Maven output on mvn test:
$ mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.example:example:jar:1.0
[INFO] task-segment: [test]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 13 source files to /home/danny/workspace/example/target/classes
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 3 source files to /home/danny/workspace/example/target/test-classes
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: /home/danny/workspace/example/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10 seconds
[INFO] Finished at: Sun Jun 17 18:09:45 CEST 2012
[INFO] Final Memory: 17M/42M
[INFO] ------------------------------------------------------------------------
You need to add the maven surefire plugin to run the tests. The configuration can be found here.
Here's a configuration that I've been using with specs/junit.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<includes>
<include>**/*Spec.*</include>
<include>**/*Test.*</include>
</includes>
</configuration>
</plugin>
The naming convention is Test, so change PropertyTests to PropertyTest.

mvn compiler:compile works, mvn compile not

I have a project with a maven 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>Minimal-J</groupId>
<artifactId>Minimal-J</artifactId>
<version>0.1-SNAPSHOT</version>
<name>Minimal-J</name>
<dependencies>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.8.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.8.2.2</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>6.7.6</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.miglayout</groupId>
<artifactId>miglayout</artifactId>
<version>3.7.4</version>
</dependency>
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
if I execute
mvn compiler:compile
all 189 of my java classes are compiled
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Minimal-J 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-compiler-plugin:2.4:compile (default-cli) # Minimal-J ---
[INFO] Compiling 189 source files to C:\projects\open-ech\workspace\minimal-j\MinimalJ\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.386s
[INFO] Finished at: Fri May 11 11:50:54 CEST 2012
[INFO] Final Memory: 13M/37M
[INFO] ------------------------------------------------------------------------
if I simply type
mvn compile
Nothing seems to be done:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Minimal-J 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.120s
[INFO] Finished at: Fri May 11 11:53:36 CEST 2012
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
In a other project everything works fine.
Where could I possibly have configured something wrong to trigger this behaviour?
It's because of pom packaging. By invoking mvn compiler:compile you run compile goal outside Maven's default lifecycle and that basically compile sources in src/main/java. And by mvn compile you run lifecycle up to compile phase and the actual goals executed in every single phase depend on project's packaging type then. pom-type project does nothing in compile phase, because - in fact - there is nothing to compile with just POM.
I suppose your intention was to have jar packaging and changing that should help.

Resources