How to run a plugin only on a particular platform - linux

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.)

Related

Springboot maven plugin to build and deploy images to gitlab is showing published 42 years ago

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

Test broken on jenkins but running locally

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.

jaxb2 goal is not invoked

I am using maven-jaxb2-plugin to generate some classes from xsd.
It is defined in child pom as follows:
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.0</version>
<executions>
<execution>
<id>jaxb2-generate</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<forceRegenerate>true</forceRegenerate>
<!-- Generate classes from XSD (XML Schema) using JAXB -->
<schemaDirectory>src/main/resources/com/reportcenter/settings/</schemaDirectory>
<generatePackage>com.reportcenter.settings</generatePackage>
<schemaIncludes>
<include>**/*.xsd</include>
</schemaIncludes>
<strict>false</strict>
<extension>true</extension>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.2</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.2</version>
</plugin>
</plugins>
<args>
<arg>-Xannotate</arg>
<arg>-XtoString</arg>
<arg>-Xcopyable</arg>
</args>
</configuration>
</plugin>
</plugins>
</pluginManagement>
The problem is the jaxb2 is not called from mvn install or mvn compile or mv generate-sources.
If I call mvn jaxb2:generate (as the name of the goal) the classes are created OK.
I looked at some questions here and used the answers provided, but I am still missing something.
Thank you.
Disclaimer: I am the author of the maven-jaxb2-plugin.
Seems like you only configure the plugin in pluginManagement but don't actualy use it in your build part.
This is how it should look like:
<project ...>
...
<build>
<plugins>
...
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
...
</project>
Few other comments on your configuration:
0.8.0 is a very old version, 0.12.3 is the actual one.
With modern Maven you no longer need to configure maven-compiler-plugin with source/target version 1.6.
Do not use forceRegenerate.
Consider using binding files instead of generatePackage.
Current version of jaxb2-basics is 0.9.2.
I ran into an error related to this plugin, and the Eclipse Maven integration.
Most searches for an answer were fruitless, but often lead to this thread. So, I'm going to post the issue, and a workaround here, for any others that run into it.
While using the maven-jaxb2-plugin:0.12.3 plugin correctly in maven on the command line - in Eclipse, source generation would fail with the following error:
Execution default of goal
org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate failed: A
required class was missing while executing
org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate:
com/sun/xml/bind/api/ErrorListener
Various attempts at adding jar files that contain the class it was looking for would just result in another class missing, going to a rabbit hole of jar file hell and mis-matched classes that wasn't resolvable.
I don't know if the problem here is something that is broken in the Eclipse / M2E integration, or if the problem is in the dependency stack of maven-jaxb2-plugin.
But the solution is to launch Eclipse itself (not the JREs / JDKs installed into eclipse) with a JDK, instead of a JRE.
The easiest way to do that is to add -vm parameter to your eclipse.ini file:
-startup plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
-vm C:\Program Files\Java\jdk1.8.0_31\bin\javaw.exe
--launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20150204-1316
-product
...snip...
Upgrade to version 0.13.2 +
Kudos to #lexicore for the comment below

How to set an environment variable in maven depending on the OS

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>

using maven in linux

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

Resources