How to set liquibase classpath - jhipster

I created a JHipster project. I would like to run the liquibase changesets manually. By default the changesets are included from the classpath. The changelog is in src/main/resources/config/liquibase/master.xml, and the changesets are in src/main/resources/config/liquibase/changelog.
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<include file="classpath:config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
</databaseChangeLog>
When running mvn liquibase:update, I get an error because the changesets are not in the classpath even though the file exists:
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default-cli) on project playground: Error setting up or running Liquibase: liquibase.exception.SetupException: classpath:config/liquibase/changelog/00000000000000_initial_schema.xml does not exist -> [Help 1]
So I try to run from the command line by setting the classpath.
liquibase --classpath=src/main/resources --classpath=postgresql-42.1.3.jar
--url=jdbc:postgresql://localhost:5432/playground
--driver=org.postgresql.Driver
--changeLogFile=src/main/resources/config/liquibase/master.xml
--username playground --password=***** update
with the same error: Unexpected error running Liquibase: classpath:config/liquibase/changelog/00000000000000_initial_schema.xml does not exist
A workaround is to remove the reference classpath: in the include part but I would like to avoid to edit the file each time a changeset is added by jhipster when using jhipster entity or jhipster import-jdl.

The solution is to run mvn process-resources before running a liquibase command, so the files under src/main/resources will be in the target/classes folder. And then remove the classpath: part as stated in https://github.com/jhipster/generator-jhipster/pull/6121

well... I faced the same problem due I don't want that jhipster automatically update the production database.
So starting with #Sydney suggestion I decided to write a new profile in POM that changes the 'classpath:' word in process-resources phase, and for that I used an ANT plugin for make an replacement over master.xml file to <empty>. So this was a result:
<profile>
<id>only-liquibase</id>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
<configuration>
<changeLogFile>target/classes/config/liquibase/master.xml</changeLogFile>
<driver></driver>
<url></url>
<defaultSchemaName></defaultSchemaName>
<username>dentalaser</username>
<password></password>
<referenceUrl>hibernate:spring:ec.com.dentalaser.domain?dialect=&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
<verbose>true</verbose>
<logging>debug</logging>
</configuration>
<dependencies>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassist.version}</version>
</dependency>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>${liquibase-hibernate5.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${validation-api.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo>Reemplazando el classpath el archivo a desplegar en AWS</echo>
<replace file="${project.build.directory}/classes/config/liquibase/master.xml" token="classpath:" value=""/>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
After that from command line execute something like this:
./mvnw process-resources liquibase:updateSQL -DskipTests -Dliquibase.url="jdbc:postgresql://<IP>:<PORT>/<DATABASE>" -Dliquibase.password="<supersecret>" -Ponly-liquibase
or this:
./mvnw process-resources liquibase:updateSQL -DskipTests -Dliquibase.url="offline:postgresql" -Ponly-liquibase
I really hope that this help you!!!

Related

Unable to resolve class com.atlassian.jira.component.ComponentAccessor

I am trying to run a Groovy script on IntelliJ IDEA, the Groovy script I am trying to run is called UsersCount.groovy, it looks like this
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager
def userManager = ComponentAccessor.getUserManager() as UserManager
def message = "My instance contains ${userManager.totalUserCount} user(s)."
log.warn(message)
When I run this code, I get the following error message
"C:\Program Files\Zulu\zulu-8\bin\java.exe" "-Dtools.jar=C:\Program Files\Zulu\zulu-8\lib\tools.jar" -Dgroovy.home=C:\Users\mouh\.m2\repository\org\codehaus\groovy\groovy-all\2.4.6 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\lib\idea_rt.jar=59917:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\mouh\.m2\repository\org\codehaus\groovy\groovy-all\2.4.6\groovy-all-2.4.6.jar org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain --classpath .;C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\target\classes --encoding=UTF-8 C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\src\main\resources\UsersCount.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\src\main\resources\UsersCount.groovy: 2: unable to resolve class com.atlassian.jira.user.util.UserManager
# line 2, column 1.
import com.atlassian.jira.user.util.UserManager
^
C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\src\main\resources\UsersCount.groovy: 1: unable to resolve class com.atlassian.jira.component.ComponentAccessor
# line 1, column 1.
import com.atlassian.jira.component.ComponentAccessor
^
2 errors
How can I fix this error and make sure that the imports are resolved? I made sure to include the dependency for com.atlassian.jira in my pom.xml file. My pom.xml file looks like this
<?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>
<!-- I added the parent pom.xml, which does all the magic. I took this pom.xml from the ScriptRunner sample plugin -->
<parent>
<groupId>com.adaptavist.pom</groupId>
<artifactId>scriptrunner-jira-standard</artifactId>
<version>10</version>
<relativePath/>
</parent>
<groupId>ru.matveev.alexey.scriptrunner</groupId>
<artifactId>scriptrunner-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>scriptrunner-plugin</name>
<description>This is the ru.matveev.alexey.scriptrunner:scriptrunner-plugin plugin for Atlassian JIRA.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<!-- I excluded a couple of dependencies from the dependency below, because the plugin did not want to start for ScriptRunner versions higher than 5.3.0 -->
<dependency>
<groupId>com.onresolve.jira.groovy</groupId>
<artifactId>groovyrunner</artifactId>
<version>${scriptrunner.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.onresolve.scriptrunner.platform</groupId>
<artifactId>scriptrunner-test-libraries-jira</artifactId>
</exclusion>
<exclusion>
<groupId>jndi</groupId>
<artifactId>jndi</artifactId>
</exclusion>
<exclusion>
<groupId>jta</groupId>
<artifactId>jta</artifactId>
</exclusion>
<exclusion>
<groupId>is.origo.jira</groupId>
<artifactId>tempo-plugin</artifactId>
</exclusion>
<exclusion>
<groupId>com.tempoplugin</groupId>
<artifactId>tempo-core</artifactId>
</exclusion>
<exclusion>
<groupId>groovyrunner</groupId>
<artifactId>test</artifactId>
</exclusion>
<exclusion>
<groupId>com.atlassian.plugin.automation</groupId>
<artifactId>automation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<!-- I increased JVM memory, because Jira 7.9.0 does not want to run with the default settings -->
<jvmArgs>-Xms512M -Xmx1g</jvmArgs>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<applications>
<!-- I added Jira Software to the plugin because I want Jira Software to start on the atlas-run command. -->
<application>
<applicationKey>jira-software</applicationKey>
<version>${jira.version}</version>
</application>
<!-- I added Jira Service Desk to the plugin because I want Jira Service Desk to start on the atlas-run command. -->
<application>
<applicationKey>jira-servicedesk</applicationKey>
<version>${jira.servicedesk.application.version}</version>
</application>
</applications>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<Export-Package>
ru.matveev.alexey.scriptrunner.api,
</Export-Package>
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*
</Import-Package>
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>7.9.0</jira.version>
<jira.servicedesk.application.version>3.12.0</jira.servicedesk.application.version>
<scriptrunner.version>5.3.9</scriptrunner.version>
<amps.version>6.3.6</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.0.0</atlassian.spring.scanner.version>
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<testkit.version>6.3.11</testkit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<!-- This is required to find the parent pom and ScriptRunner dependencies -->
<repository>
<id>adaptavist-external</id>
<url>https://nexus.adaptavist.com/content/repositories/external</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>
</repositories>
</project>
You should specify the path to the Atlassian SDK maven:
Go to Settings (Alt+Ctrl+S) -> Build, Execution, Deployment -> Build -> Maven
In the "Maven home path" set the path to the location where your installed Atlassian SDK is and its direct child maven sub-folder.
In the User settings file checkbox the Override option and menu below specify the path to the "settings.xml" file inside the maven sub-folder of the path above
Click Save to save the changes of the IDEA settings
As your local Maven is not configured to see Atlassian repos.

When I run cucumber with testng, using mvn command line, how do I display the allure report

When I try to run the cucumber-testng by using mvn clean test the result says, 1test run, how do I generate allure report displaying the Scenarios and Steps
Firstly: you need to enable and configure surefire plugin for TestNG.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<systemProperties>
<property>
<name>allure.results.directory</name>
<value>${project.build.directory}/allure-results</value>
</property>
</systemProperties>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/TestNG.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.10</version>
</dependency>
</dependencies>
</plugin>
Add dependency to your pom as well:
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.12.1</version>
</dependency>
And finally add allure maven plugin:
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>
</plugin>
Secondly: you need to let your tests know where you allure results directory is (in my sxample - allure-results directory in root directory). You can achieve that by adding allure.properties file in your resources folder with value: allure.results.directory=target/allure-results.
After that you can issue mvn allure:serve after your tests completed.

Build dependency with a specific profile

I have a web project with a dependency I want to compile on a different profile so it generates some additional files I want on the web project.
To be more specific, a Web project with a Netbeans Application as dependency. The Netbeans project has a deployment profile that created the update center (just a folder with files in it). I want this update center to be added to the war file for deployment.
Is there a way to make the web project build the dependency on this profile so I get the files I need?
Is there other options to make this work?
Update: Example
<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>
<!-- The Basics -->
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<dependencies>
<dependency>
<groupId>project-of-interest</groupId>
<artifactId>project-id</artifactId>
<version>4.0</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>resource2</directory>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
project-of-interest has a deployment profile in which the files I need are generated and somehow resource2 points to the location of those files.
My main issue is making sure the files I need are available.
you can point to specific profile with maven command
mvn clean install -P $profile

Maven ANTLR generating wrong directory

I have the following 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>db.project</groupId>
<artifactId>engine</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<antlr4.visitor>true</antlr4.visitor>
<antlr4.listener>true</antlr4.listener>
</properties>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.0</version>
<configuration>
<sourceDirectory>src</sourceDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Normally, I use ANLTR 4 plugin which is described in this link : https://github.com/jknack/antlr4ide . But I want to use maven now, when I update my grammar in com.db.project directory, parser and lexer are generated in both default package (i.e., src/default package) and src/com/db/project/ twice, whereas I only want my lexer and parser in src/com/db/project/ directory. (including both .g4 file and java files in the same package)
How can I change this via pom.xml?
Simple change 4.0 to 4.2 in your antlr4-maven-plugin's version tag.
Note that the plugin will recursively scan src/main/antlr4 for .g4 grammar files. If your grammar resides in src/main/antlr4/com/company then the package of your generated parser/lexer files will be com.company.
Here's a small template project to get you started, in case you need it:
https://github.com/bkiers/antlr4-template

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