I am fairly new to maven. I have setup a pom.xml which defines a profile for running my unit tests. I am trying to set Path environment variable. The env variable name is Path for Windows and LD_LIBRARY_PATH for Linux. I don't want to keep on changing these env. variable names depending on the OS. How should I achieve this?
<profile>
<id>integration-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tychoVersion}</version>
<configuration combine.self="override">
<argLine>${tycho.testArgLine} ${global.test.vmargs} ${bundle.test.vmargs}</argLine>
<forkMode>${bundle.test.forkMode}</forkMode>
<useUIHarness>${bundle.test.useUIHarness}</useUIHarness>
<useUIThread>${bundle.test.useUIThread}</useUIThread>
<environmentVariables>
<!--For windows change LD_LIBRARY_PATH to PATH-->
<LD_LIBRARY_PATH>${dependenciesDir}${path.separator}{env.LD_LIBRARY_PATH}</LD_LIBRARY_PATH>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Profile activation might help here. Remove the <environmentVariables> config from the integration tests profile. Then add the profiles below, tweaking the <activation> sections to meet the specific requirements. You do not need to explicitly enable these profiles on the command line; Maven will activate the right profile based on which system is running the build.
<profile>
<id>windows-tests</id>
<activation>
<os>
<family>Windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tychoVersion}</version>
<configuration>
<environmentVariables>
<PATH>${dependenciesDir}${path.separator}{env.PATH}</PATH>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>linux-tests</id>
<activation>
<os>
<family>Linux</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tychoVersion}</version>
<configuration>
<environmentVariables>
<LD_LIBRARY_PATH>${dependenciesDir}${path.separator}{env.LD_LIBRARY_PATH}</LD_LIBRARY_PATH>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Related
I am using spring-boot-maven-plugin with the following profile
<profiles>
<profile>
<id>ci</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>build</id>
<goals>
<goal>build-info</goal>
<goal>build-image</goal>
</goals>
<configuration>
<image>
<name>${env.DOCKER_IMAGE_PATH}/core:${env.CI_COMMIT_SHORT_SHA}</name>
<publish>true</publish>
</image>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
The image could be built and uploaded to gitlab. However, it is always showing Published 42 years ago.
Any idea?
It looks it is related to Reproduible Builds
https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#why-is-my-image-created-48-years-ago
we are working in a multi-module maven project in both Linux machine and Mac machine with the same pom.xml, and we run the below command in offline mode
mvn install antrun:run -o
The problem is maven downloads a different version of plugins for the same pom.xml file. The difference is listed here comparison of Mac and Linux machine plugin jars
We did not specify the version of plugins in 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>
<groupId>com.test</groupId>
<artifactId>Testing</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<inherited>false</inherited>
<executions>
<execution>
<id>Test</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>test.mac_linux</groupId>
<artifactId>Test</artifactId>
<version>1.0</version>
<file>${home_dir}/Downloads/jackson-databind-2.4.4.jar</file>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<configuration>
<phase>install</phase>
<target>
<zip destfile="${home_dir}/linux_mac_testing_maven/Testing_mac.zip">
<fileset dir="${home_dir}/.m2/repository/" includes="**/*" />
</zip>
</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources-WEB_INF</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${home_dir}/linux_mac_testing_maven/Resources/</outputDirectory>
<resources>
<resource>
<directory>${home_dir}/CustomReport_files/</directory>
<includes>
<include>**.*</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
does anybody know why maven differs its characteristics when subjected to a different operating system?
You mention in https://jira.apache.org/jira/projects/MNG/issues/MNG-6470 you are using different versions of Maven (3.5 on Mac and 3.3.9 on Linux). Please update both to latest (3.5.4) and then compare results.
I have a maven plugin that only needs to execute on linux. I found this configuration that seems to work
How do I make this plugin run only on non-Windows platforms?
<profiles>
<profile>
<activation>
<os>
<family>!mac</family>
</os>
</activation>
<build>
<plugins>
<plugin>
...
</plugin>
</plugins>
</build>
...
</profile>
</profiles>
How do I modify it so that it executes only on linux?
There is no OS <family> value that distinguishes Linux from Unixes, but you can use <name> instead.
<profiles>
<profile>
<activation>
<os>
<name>Linux</name>
</os>
</activation>
<build>
<plugins>
<plugin>
...
</plugin>
</plugins>
</build>
...
</profile>
</profiles>
FYI, to double-check the value for <name> on your Linux machine, execute java -XshowSettings:properties and look for the os.name property. (On all Linux distributions I have checked, this is just Linux.)
we are having such a weird error. Our Tests are running in the local machines (windows) but not running on jenkins (linux).
We get a
Caused by: java.lang.RuntimeException: There was an error in the forked process
java.lang.NoClassDefFoundError:
I'm being looking for solution and got this info on bugzilla
or archive.
Has anybody an idea about this issue and how to solve it?
Thanks
UPDATE
maven-surefire-plugin is also defined in the parent pom.xml for using with cobertura. The Tests are running twice but the second time the tests fails as described above.
I'm defining 2 profiles that are using the surefire-plugin and a surefire plugin definition in the section.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*SoapUiTest.java</exclude>
</excludes>
<excludes>
<!--exclude>**/*.java</exclude -->
</excludes>
<additionalClasspathElements>
<additionalClasspathElement>${basedir}/src/main/java</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>soapUi</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*EntityTest.java</exclude>
</excludes>
<includes>
<include>**/*SoapUiTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*EntityTest.java</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
What I'm doing wrong?
I remember having similar issue. It might be related to ulimit - number of allowed opened files. ClassLoader needs to open file for loading. Since class is not loaded/available NoClassDefFoundError is thrown on method call.
Check how many files can be opened:
ulimit -a
To increase number of opened files:
ulimit -n NEW_NUMBER
In order to change it permanently follow instructions from this link
Follow the steps:
vi /etc/security/limits.conf and add below the mentioned
soft nofile 65535
hard nofile 65535
It was an ussue with cobertura itself (-Dcobertura.test=true). Activating it resolved the Problem.
I'm using Maven3 in Linux (CentOs 5.x)
And run linux) mvn install -Preal
But following error occurs.
Here's error messages
...
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[36,51] package org.springframework.beans.factory.annotation does not exist
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[37,51] package org.springframework.beans.factory.annotation does not exist
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[38,37] package org.springframework.orm.ibatis does not exist
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[39,48] package org.springframework.security.core.context does not exist
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[40,52] package org.springframework.security.core.userdetails does not exist
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[41,37] package org.springframework.stereotype does not exist
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[42,49] package org.springframework.transaction.annotation does not exist
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[43,40] package org.springframework.web.multipart does not exist
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[44,40] package org.springframework.web.multipart does not exist
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[56,24] package com.sun.mail.smtp does not exist
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[58,1] cannot find symbol
[ERROR] symbol: class Service
[ERROR] #Service
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[59,1] cannot find symbol
[ERROR] symbol: class Transactional
[ERROR] #Transactional
[ERROR] /data/byto_openapi/src/main/java/com/byto/openapi/home/HomeServiceImpl.java:[64,9] cannot find symbol
...
And this is CLASSPATH
declare -x CLASSPATH=".:/usr/java/jdk/lib/tools.jar:/usr/local/tomcat/lib:/usr/local/tomcat/lib/servlet-api.jar:/usr/local/tomcat/lib/mysql-connector-java-5.1.17-bin.jar:/usr/local/tomcat/webapps/ROOT/WEB-INF/classes:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/bcprov-jdk16-146.jar:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/bcprov-ext-jdk16-146.jar:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/commons-lang-2.6.jar:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/javapns-jdk16-161.jar:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/log4j-1.2.16.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib:/data/byto_openapi/src/main/webapp/WEB-INF/lib/aspectjweaver-1.6.8.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/jstl-1.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/cglib-2.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/tiles-template-2.2.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/commons-digester-2.0.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/bcprov-ext-jdk16-146.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/commons-fileupload-1.2.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/log4j-1.2.14.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/commons-lang-2.1.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-security-config-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/ibatis-sqlmap-2.3.4.726.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-orm-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-security-ldap-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/commons-lang-2.6.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/commons-pool-1.3.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/commons-beanutils-1.8.0.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-security-core-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/commons-dbcp-1.2.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/tiles-api-2.2.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-tx-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/mail.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/aspectjrt-1.6.9.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-test-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/slf4j-log4j12-1.5.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/derbyclient-10.4.2.0.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-asm-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-context-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-jdbc-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-security-acl-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/javapns-jdk16-161.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-webmvc-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/asm-3.1.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/slf4j-api-1.5.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/aopalliance-1.0.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/jcl-over-slf4j-1.5.10.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-security-web-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-context-support-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-core-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/commons-io-1.3.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/activation.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/jackson-mapper-asl-1.9.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/tiles-servlet-2.2.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-aop-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/mysql-connector-java-5.1.19-bin.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-ldap-core-1.3.0.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-expression-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-beans-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/cos.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/tiles-jsp-2.2.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/org.springframework.roo.annotations-1.0.2.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/tiles-core-2.2.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/jackson-core-asl-1.9.2.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/junit-4.7.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-security-taglibs-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/spring-web-3.0.5.RELEASE.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/bcprov-jdk16-146.jar:/data/byto_openapi/src/main/webapp/WEB-INF/lib/javax.inject-1.jar"
As you can see all the JARs are included in CLASSPATH..
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>cyoz</groupId>
<artifactId>cyoz</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<database.defaultAutoCommit>true</database.defaultAutoCommit>
<database.validationQuery>select 1</database.validationQuery>
<database.testWhileIdle>true</database.testWhileIdle>
<database.timeBetweenEvictionRunsMillis>7200000</database.timeBetweenEvictionRunsMillis>
<spring.version>3.0.5.RELEASE</spring.version>
<tiles.version>2.2.2</tiles.version>
<image.path>/data/api_svn_www/file/image</image.path>
</properties>
<build>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<scriptSourceDirectory>${basedir}/src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<targetPath>${basedir}/target/webapp</targetPath>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<targetPath>${basedir}/target/classes</targetPath>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>${basedir}/src/test/resources</directory>
</testResource>
</testResources>
<filters>
<filter>${basedir}/src/main/resources/spring-common-bean-context.xml</filter>
<filter>${basedir}/src/main/resources/byto.cyoz.properties</filter>
</filters>
</build>
<profiles>
<profile>
<id>dev</id>
<properties>
<database.classname>me.kun.log4jdbc.DriverSpy</database.classname>
<database1.url>jdbc:log4jdbc:mysql://211.174.62.34:3306/bytoapi?autoReconnect=true</database1.url>
<database1.username>bytoapi</database1.username>
<database1.password>bytoapi1213</database1.password>
<database2.url>jdbc:log4jdbc:mysql://211.174.62.34:3306/byto_memo?autoReconnect=true</database2.url>
<database2.username>byto_memo</database2.username>
<database2.password>memo1213</database2.password>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<warSourceDirectory>src/main/webapp/</warSourceDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<wtpversion>1.5</wtpversion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-idea-plugin</artifactId>
<version>2.2</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<dependenciesAsLibraries>true</dependenciesAsLibraries>
<useFullNames>false</useFullNames>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<!--<encoding>EUC-KR</encoding> -->
</configuration>
</plugin>
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
<inherited>false</inherited>
<configuration>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<url>http://211.174.62.34:8080/manager/html</url>
<path>/cyoz</path>
<username>tomcat</username>
<password>tomcat</password>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>real</id>
<properties>
<database.classname>com.mysql.jdbc.Driver</database.classname>
<database1.url>jdbc:mysql://127.0.0.1:3306/bytoapi?autoReconnect=true</database1.url>
<database1.username>bytoapi</database1.username>
<database1.password>bytoapi1213</database1.password>
<database2.url>jdbc:mysql://127.0.0.1:3306/byto_memo?autoReconnect=true</database2.url>
<database2.username>byto_memo</database2.username>
<database2.password>memo1213</database2.password>
</properties>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.2</version>
</dependency>
</dependencies>
linux /etc/profile which set CLASSPATH to compile *.java
# tomcat CLASSPATH
SOURCE_FOLDER=/data/byto_openapi
LIBRARY_FOLDER=$SOURCE_FOLDER/src/main/webapp/WEB-INF/lib
export CLASSPATH=$CLASSPATH:$LIBRARY_FOLDER
for file in `find $LIBRARY_FOLDER -name "*.jar" -type f`
do
export CLASSPATH=$CLASSPATH:$file
done
Maven does not look for the CLASSPATH variable to pick up its dependencies. Instead, it manages its own dependencies as specified in the pom.xml file. Indeed, this is the number one reason for using Maven in my book.
Have a look at Maven - Introduction to the Dependency Mechanism for a quick start to dependency management with Maven.
For inspecting the actual classpaths used by the Maven plugins run the build with the --debug argument, for instance
mvn --debug clean install -Preal