webstart maven plugin with dependencies - maven

My boss told me to work with the Maven Web Start plugin to generate a JNLP and a signed JAR.
The problem is no matter how I try I couldn't make a JAR containing my dependencies.
I'm always facing a ClassDefNotFound Exception
pom.xml
<repositories>
<repository>
<releases />
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>mygrid-repository</id>
<name>myGrid Repository</name>
<url>http://www.mygrid.org.uk/maven/repository</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo.webstart</groupId>
<artifactId>webstart-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>jnlp</goal>
</goals>
</execution>
</executions>
<configuration>
<jnlp>
<outputFile>ctScan.jnlp</outputFile>
<mainClass>com.test.testScan.App</mainClass>
</jnlp>
<libPath>lib</libPath>
<outputJarVersions>true</outputJarVersions>
<includes>
<include>commons-logging:commons-logging</include>
<include>commons-cli:commons-cli</include>
</includes>
<sign>
<keystore>../../ctKeystore</keystore>
<keypass>CreativeKeypass</keypass>
<storepass>CreativeKeypass</storepass>
<alias>CreativeScan</alias>
<dnameCn>Mohcine Wannas</dnameCn>
<dnameOu>DARD</dnameOu>
<dnameO>Creative technologies</dnameO>
<dnameL>Rabat</dnameL>
<dnameSt>Rabat</dnameSt>
<dnameC>ma</dnameC>
<verify>true</verify>
</sign>
<pack200>false</pack200>
<gzip>true</gzip>
<outputJarVersions>false</outputJarVersions>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.test.testScan.App</mainClass>
</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>uk.co.mmscomputing</groupId>
<artifactId>device</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>net.htmlparser.jericho</groupId>
<artifactId>jericho-html</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>0.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.jai-imageio</groupId>
<artifactId>jai-imageio-core-standalone</artifactId>
<version>1.2-pre-dr-b04-2011-07-04</version>
</dependency>
<dependency>
<groupId>javax.media.jai</groupId>
<artifactId>com.springsource.javax.media.jai.codec</artifactId>
<version>1.1.3</version>
</dependency>
</dependencies>
build output
please add your build output here (and possibily the directory structure created and its content, notably the content of the lib/ folder, if it went that far)

The webstart-maven-plugin doesn't create a JAR with the dependencies, it creates a JAR along with the JARs of dependencies in the lib/ folder.
If you want to package everything in one JAR, you'd need to use the maven-shade-plugin.

Related

I see error with surefire error even though all my test pass, no anwers related to surefire plugin helped me

Recently i migrated surefire plugin from 2.15 to 3.0.0-M5 and i see this below error even though all the test case passed. i dont see anything in report generated, just a empty file. Google nor stackoverflow helped me. Trying this out for almost a week, was not successful. Any idea on this? Any help will appreciated. Thanks
stacktrace details :
INFO: Creating GrizzlyTestContainer configured at thre base eU tReIs httt fpai://lurels.oc
alPlease host:<AVAILABLE-PORT>/
refer to C:\myproject\target\surefire-15:33:40.193 [main] DEBUG org.hibernate.validator.internal.engine.reso
lver.DefaultTraversableResolver - Cannot find javax.persistence.Persistence on classpath. Assuming non JPA 2 environment. All properties will per
default be traversable.
reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_161\jre\bin\java" -jar C:\Users\atest\AppData\Local\Temp\surefire550827656934128985\s
urefirebooter3900377300994647315.jar C:\Users\atest\AppData\Local\Temp\surefire550827656934128985 2020-09-17T15-27-08_835-jvmRun1 surefire826710
7066485510027tmp surefire_05426397409004431606tmp"
Process Exit Code: 0
Crashed tests:
com.ServiceSpec
org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit ca
lled?
Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_161\jre\bin\java" -jar C:\Users\<id>\AppData\Local\Temp\surefire550827656934128985\s
urefirebooter3900377300994647315.jar C:\Users\<id>\AppData\Local\Temp\surefire550827656934128985 2020-09-17T15-27-08_835-jvmRun1 surefire826710
7066485510027tmp surefire_05426397409004431606tmp"
Process Exit Code: 0
Crashed tests:
com.ServiceSpec
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:748)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:305)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:265)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1314)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1159)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:932)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execut15:33:40.193 [main] DEBUG org.hibernate.validator.internal.engine.ConfigurationI
mpl - Setting custom ParameterNameProvider of type io.dropwizard.jersey.validation.JerseyParameterNameProvider
e(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
My pom.xml
<properties>
<!-- java compiler version -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-stringtemplate4</artifactId>
<version>3.9.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jdbi/jdbi3-sqlobject -->
<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-sqlobject</artifactId>
<version>3.9.1</version>
</dependency>
<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-core</artifactId>
<version>3.9.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.1.jre8</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
<scope>test</scope>
</dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.0-groovy-2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.3</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-web</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.10.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testSourceDirectory>${TestSourceDirectory}</testSourceDirectory>
<testResources>
<testResource>
<directory>${TestResourceDirectory}</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/cxf/bus-extensions.txt</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>someclass</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/hk2-locator/default</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/kie.conf</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.11.1-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<source>1.8</source>
<target>1.8</target>
<complianceLevel>1.8</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<aspectLibraries>
<aspectLibrary>
<groupId>mygroupid</groupId>
<artifactId>utils</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<tarLongFileMode>posix</tarLongFileMode>
<finalName>${project.name}-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
<!-- Groovy test compilation -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<!-- 2.8.0-01 and later require maven-compiler-plugin 3.1 or higher -->
<version>3.9.0-SNAPSHOT</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>3.6.0-03</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.4.3-01</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>3.6.0-03</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>unit</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<TestSourceDirectory>src/test/java</TestSourceDirectory>
<TestResourceDirectory>src/test/resources</TestResourceDirectory>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>3.0.0-M5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>3.0.0-M5</version>
</dependency>
</dependencies>
<configuration>
<includes>
<include>**/*.java</include>
</includes>
<!-- For UTC parallel execution: with below parallel type and thread count, the performance is noticable -->
<parallel>classesAndMethods</parallel>
<threadCount>2</threadCount>
<perCoreThreadCount>true</perCoreThreadCount>
<useUnlimitedThreads>false</useUnlimitedThreads>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>functional</id>
<properties>
<TestSourceDirectory>src/test/functional/java</TestSourceDirectory>
<TestResourceDirectory>src/test/resources</TestResourceDirectory>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>3.0.0-M5</version>
</dependency>
</dependencies>
<configuration>
<includes>
<include>**/*.java</include>
<!-- needed for Groovy Spock tests -->
<include>**/*Spec.*</include>
</includes>
<argLine>
-Xmx1024m
</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>central</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<name>releases</name>
<url>https://myurl</url>
</repository>
<repository>
<id>central-pre-release</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<name>prereleases</name>
<url>https://myurl</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>central</id>
<name>Internal Repository</name>
<url>https://myurl</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshots</name>
<url>https://myurl</url>
</snapshotRepository>
</distributionManagement>
<pluginRepositories>
<pluginRepository>
<id>snapshot maven dependencies</id>
<url>https://myurl</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
You have to see your own logs.
See that your test crashed the JVM execution:
Crashed tests: com.ServiceSpec
Then see the dump files in target/surefire-reports with the crash errors, and see this sentence:
Please refer to dump files (if any exist) [date].dump,
[date]-jvmRun[N].dump and [date].dumpstream.
If you use JUnit5 and your #BeforeAll method has failed, the latest version of Surefire would fail the test, but not to crash it.
Problem was:: surefire was failing to read the errors because its too big and crashing
Creating logback.xml in /src/test/resources/ fixed this.
Content of logback.xml is:
<logger name="org.hibernate" level="warn"/>

Issue in Compiling SOA 12C project with Maven

I am trying to build my SOA 12.2.1.0.0 project with Maven3.2.5 and using the default Maven local repository.I have done the below steps:
1.Installed the Maven synchronisation plugin to the local respository(mvn install)
2.Pushed all the required libraries to the local repository using Push goal
3.Updated the archetype to reflect the newly installed libraries.
When I am trying to compile the project using Maven, I am getting the below errors like:
1.0-SNAPSHOT: Failed to collect dependencies at com.oracle.adf.library:BC4J-Service-Runtime:pom:12.2.1-0-0' 'No
versions available for
com.oracle.legacy_oc4j_xml_schemas:com.oracle.webservices.fmw.web-common-schemas-impl:jar:[12.2.1,12.2.2)
within specified range
The com.oracle.legacy_oc4j_xml_schemas of the repository contains a folder(com.oracle.webservices.fmw.web-common-schemas-impl) with a single file resolver-status.properties having the content:
maven-metadata-central.xml.error=
maven-metadata-central.xml.lastUpdated=1468297090681
Below is the effective pom:
<?xml version="1.0" encoding="UTF-8"?>
<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>com.oracle.soa</groupId>
<artifactId>sar-common</artifactId>
<version>12.2.1-0-0</version>
<relativePath></relativePath>
</parent>
<groupId>MavenIntegrationApplication</groupId>
<artifactId>TestProjectMaven</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>sar</packaging>
<description>Oracle FMW Common Parent POM</description>
<url>http://www.oracle.com/us/products/middleware/overview/index.html/sar-common/TestProjectMaven</url>
<inceptionYear>2012</inceptionYear>
<properties>
<password></password>
<scac.input>D:\JDEVWorkspace-12C\TestProjectMaven/SOA//composite.xml</scac.input>
<oraclePassword></oraclePassword>
<overwrite>true</overwrite>
<composite.partition>default</composite.partition>
<regenerateRulebase>false</regenerateRulebase>
<scac.error>D:\JDEVWorkspace-12C\TestProjectMaven/target/error.txt</scac.error>
<oracleServerUrl>http://localhost:7003</oracleServerUrl>
<scac.output.dir>D:\JDEVWorkspace-12C\TestProjectMaven/target</scac.output.dir>
<composite.revision>1.0</composite.revision>
<oracleHome>${env.ORACLE_HOME}</oracleHome>
<forceDefault>true</forceDefault>
<scac.displayLevel>1</scac.displayLevel>
<composite.name>TestProjectMaven</composite.name>
<input>TestProjectMaven</input>
<keepInstancesOnRedeploy>false</keepInstancesOnRedeploy>
<scac.output>D:\JDEVWorkspace-12C\TestProjectMaven/target/out.xml</scac.output>
<scac.input.dir>D:\JDEVWorkspace-12C\TestProjectMaven/SOA/</scac.input.dir>
<oracleServerName>soa_server1</oracleServerName>
<oracleUsername></oracleUsername>
<serverUrl>http://localhost:7003</serverUrl>
<scatest.result>D:\JDEVWorkspace-12C\TestProjectMaven/target/testResult</scatest.result>
<oracleMiddlewareHome>/home/myhome/Oracle/Middleware</oracleMiddlewareHome>
<user></user>
</properties>
<dependencies>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>SOA-Designtime</artifactId>
<version>12.2.1-0-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>SOA-Runtime</artifactId>
<version>12.2.1-0-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>BPEL-Runtime</artifactId>
<version>12.2.1-0-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>Mediator-Runtime</artifactId>
<version>12.2.1-0-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf.library</groupId>
<artifactId>MDS-Runtime</artifactId>
<version>12.2.1-0-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>D:\JDEVWorkspace-12C\TestProjectMaven\src\main\java</sourceDirectory>
<scriptSourceDirectory>D:\JDEVWorkspace-12C\TestProjectMaven\src\main\scripts</scriptSourceDirectory>
<testSourceDirectory>D:\JDEVWorkspace-12C\TestProjectMaven\src\test\java</testSourceDirectory>
<outputDirectory>D:\JDEVWorkspace-12C\TestProjectMaven\target\classes</outputDirectory>
<testOutputDirectory>D:\JDEVWorkspace-12C\TestProjectMaven\target\test-classes</testOutputDirectory>
<resources>
<resource>
<directory>D:\JDEVWorkspace-12C\TestProjectMaven\src\main\resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>D:\JDEVWorkspace-12C\TestProjectMaven\src\test\resources</directory>
</testResource>
</testResources>
<directory>D:\JDEVWorkspace-12C\TestProjectMaven\target</directory>
<finalName>TestProjectMaven-1.0-SNAPSHOT</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.oracle.soa.plugin</groupId>
<artifactId>oracle-soa-plugin</artifactId>
<version>12.2.1-0-0</version>
<extensions>true</extensions>
<configuration>
<compositeName>TestProjectMaven</compositeName>
<composite>D:\JDEVWorkspace-12C\TestProjectMaven/SOA//composite.xml</composite>
<sarLocation>D:\JDEVWorkspace-12C\TestProjectMaven/target/sca_TestProjectMaven_rev1.0-SNAPSHOT.jar</sarLocation>
<serverUrl>http://localhost:7003</serverUrl>
<user></user>
<password></password>
<compositeRevision>1.0</compositeRevision>
<revision>1.0</revision>
<scacInputDir>D:\JDEVWorkspace-12C\TestProjectMaven/SOA/</scacInputDir>
<input>TestProjectMaven</input>
</configuration>
</plugin>
<plugin>
<groupId>com.oracle.maven</groupId>
<artifactId>oracle-maven-sync</artifactId>
<version>12.2.1-0-0</version>
<configuration>
<serverId>internal</serverId>
<oracleHome>D:\OracleSOA12C\Oracle_Home</oracleHome>
<testOnly>false</testOnly>
</configuration>
</plugin>
<plugin>
<groupId>com.oracle.adf.plugin</groupId>
<artifactId>ojdeploy</artifactId>
<version>12.2.1-0-0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<ojdeploy>${env.ORACLE_HOME}/jdeveloper/jdev/bin/ojdeploy.exe</ojdeploy>
<workspace>D:\JDEVWorkspace-12C\TestProjectMaven/../MavenIntegrationApplication.jws</workspace>
<project>TestProjectMaven</project>
<profile>TestProjectMaven</profile>
<outputfile>D:\JDEVWorkspace-12C\TestProjectMaven\target/TestProjectMaven-1.0-SNAPSHOT.jar</outputfile>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<outputDirectory>D:\JDEVWorkspace-12C\TestProjectMaven\target\site</outputDirectory>
</reporting>
</project>
Can someone help me solve this issue, if I have missed to do some steps.
I think you should remove <type>pom</type> of your dependencies.
If I understand your problem correctly, you have Oracle libs (most likely JARs) provided somewhere so you don't want Maven to include these libs in your packaging. But as you indicate <type>pom</type>, Maven is trying to get the POM of these dependecies and it's not working.
This issue is resolved.It was because not all dependent jars were getting installed using the PUSH command(reason is unknown).After few more trials(deleting and reexceuting the commands), all the jars got installed and now the all the goals are hetting executed successfuly.
Thanks for all the help!

Maven: Changing remote directory structure

I have just started to learn maven a few weeks ago. Currently trying to achieve the structure in my mind. Everything up to know is perfect but, i am having an issue about deploying.
The issue is:
when i perform mvn release:perform artifacts are being deployed to my ftp server in ftp://centos-release/maven/linuxapp/releases/com/gmail/baturman/linuxapp/linuxapp/0.0.5/ path.
and when i perform mvn deploy current snapshot is being deployed to ftp server in ftp://centos-gitlab/maven/linuxapp/snapshots/com/gmail/baturman/linuxapp/linuxapp/0.0.6-SNAPSHOT/
everything is cool but, this is not the structure that i want. What i want to have this directory structure:
For release: ftp://centos-release/maven/linuxapp/releases/0.0.5/
For snapshots: ftp://centos-release/maven/linuxapp/snapshots/0.0.6-SNAPSHOT/
Could you please advise?
Here is my pom file.
<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.gmail.baturman.linuxapp</groupId>
<artifactId>linuxapp</artifactId>
<version>0.0.5-SNAPSHOT</version>
<description>Linux App - Powered by git and maven :)</description>
<name>Linux App</name>
<!-- PROPERTIES -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- DEPENDENCIES -->
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
<!-- RELEASE INFORMATION -->
<scm>
<connection>scm:git:gitlab#centos-gitlab:maven/linuxapp.git</connection>
<developerConnection>scm:git:gitlab#centos-gitlab:maven/linuxapp.git</developerConnection>
<url>http://centos-gitlab/maven/linuxapp</url>
<tag>v0.0.3</tag>
</scm>
<distributionManagement>
<repository>
<id>release-server</id>
<name>Release Repository</name>
<url>ftp://centos-gitlab/maven/${project.artifactId}/releases</url>
</repository>
<snapshotRepository>
<id>release-server</id>
<name>Snapshot Repository</name>
<url>ftp://centos-gitlab/maven/${project.artifactId}/snapshots</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
<!-- BUILD -->
<build>
<finalName>${project.artifactId}</finalName>
<!-- EXTENSIONS -->
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>2.4</version>
</extension>
</extensions>
<!-- RESOURCES -->
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/conf</directory>
<excludes>
<exclude>*.properties</exclude>
</excludes>
</resource>
</resources>
<!-- PLUGINS -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptor>src/main/assembly/assembly.xml</descriptor>
<useJvmChmod>true</useJvmChmod>
</configuration>
<executions>
<execution>
<id>release-server</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<tagNameFormat>v#{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</build>
First i would suggest to start using a repository manager like Nexus, Artifactory or Archiva which is a better solution than an ftp server. Apart from that you have to change your definitions:
<distributionManagement>
<repository>
<id>release-server</id>
<name>Release Repository</name>
<url>ftp://centos-gitlab/maven/releases/</url>
</repository>
<snapshotRepository>
<id>release-server</id>
<name>Snapshot Repository</name>
<url>ftp://centos-gitlab/maven/snapshots/</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>

External jar found in Maven Web Application but not when being deployed

I recently created a Maven Web Application through Netbeans 7.3, using GlassFish 3.1.2. In this I use an external jar, so I added it in pom.xml:
<dependencies>
...
<dependency>
<groupId>be-fedict-eid-trust-service-client</groupId>
<artifactId>eid-trust-service-client</artifactId>
<version>1.0.1.RC5</version>
</dependency>
...
</dependencies>
It shows up correctly and I can refer it in my Bean. BUT when I deploy the application, I get an error that the class in the jar (which I referred to without problems before) can not be found.
java.lang.NoClassDefFoundError: be/fedict/trust/xkms2/XKMSServiceFactory
Since I'm not that familiar with Maven, I don't know how and where I can fix this. Looking at the generated WAR file, the jar is there correctly. I set addClasspath to true so it is in the Classpath of the Manifest, but this doesn't seem to help.
My libraries are in WEB-INF/lib and my Bean is in WEB-INF/classes.
Any thoughts or general directions to what this problem may be? I found this topic: Spring Web App with Maven dependency - class not found during deploy
but I don't see how I can make it work for me (assuming he found a solution).
Thanks in advance!
My full 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>ISB</groupId>
<artifactId>eID</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>eID</name>
<repositories>
<repository>
<id>e-contract</id>
<url>https://www.e-contract.be/maven2</url>
</repository>
</repositories>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>be-fedict-eid-applet</groupId>
<artifactId>eid-applet-shared</artifactId>
<version>1.1.0.RC2</version>
</dependency>
<dependency>
<groupId>be.fedict.eid-applet</groupId>
<artifactId>eid-applet-service</artifactId>
<version>1.1.0.RC2</version>
</dependency>
<dependency>
<groupId>be-fedict-eid-applet</groupId>
<artifactId>eid-applet-service-spi</artifactId>
<version>1.1.0.RC2</version>
</dependency>
<dependency>
<groupId>be-fedict-eid-applet</groupId>
<artifactId>eid-applet-package</artifactId>
<version>1.1.0.RC2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>be-fedict-eid-trust-service-client</groupId>
<artifactId>eid-trust-service-client</artifactId>
<version>1.0.1.RC5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>be-fedict-eid-applet</groupId>
<artifactId>eid-applet-package</artifactId>
<version>1.1.0.RC2</version>
<type>jar</type>
<outputDirectory>${project.build.directory}/${project.artifactID}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I'm not sure it has anything to do with your POM. I suspect it's the libraries used in the target container (Glassfish) -- a classpath issue. Each container does classloading a little differently. This question & answer might give you some ideas. If there are two, different versions of this artifact, one in container, one in your POM, you will have to tell the container which to use. WebLogic uses a weblogic.xml file for this.

Maven reports it ran the test suite but did not run any of my JUnit tests

I am trying to test a java app from Maven using JUnit.
I have the following POM (relevant section only).
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>2.7.2</version>
</dependency>
</dependencies>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
It seems "something" is being run. Here is the output from "mvn -X test":
Running TestSuite
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.769 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Notice the "Running TestSuite". However it still fails to find my test methods. I suspect it might have to do with this:
[DEBUG] Adding to surefire test classpath: /home/julien/.m2/repository/org/apache/maven/surefire/surefire-testng/2.4.3/surefire-testng-2.4.3.jar
[DEBUG] Adding to surefire test classpath: /home/julien/.m2/repository/org/apache/maven/maven-artifact/2.0/maven-artifact-2.0.jar
[DEBUG] Adding to surefire test classpath: /home/julien/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar
[DEBUG] Adding to surefire test classpath: /home/julien/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[DEBUG] Adding to surefire test classpath: /home/julien/.m2/repository/org/apache/maven/surefire/surefire-api/2.4.3/surefire-api-2.4.3.jar
It says it is using version 3.8.1 of Junit...
However it goes on to say:
Test Classpath :
[DEBUG] /home/julien/.m2/repository/junit/junit/4.8.2/junit-4.8.2.jar
I wonder what is the difference between the "surefire test classpath" and the "Test classpath"?
Here is how my test method is named and annotated:
#Test
public void test() {
...
It is located here:
src/test/java/com/cheetah/web/pages
Any idea what I am getting wrong?
Here is the effective POM:
<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>
<parent>
<artifactId>cheetah</artifactId>
<groupId>com.cheetah</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.cheetah</groupId>
<artifactId>cheetah-web</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>cheetah-web</name>
<build>
<sourceDirectory>/home/julien/Documents/donnees/projets/site-emploi-finance/java/cheetah/web/src/main/java</sourceDirectory>
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>/home/julien/Documents/donnees/projets/site-emploi-finance/java/cheetah/web/src/test/java</testSourceDirectory>
<outputDirectory>/home/julien/Documents/donnees/projets/site-emploi-finance/java/cheetah/web/target/classes</outputDirectory>
<testOutputDirectory>/home/julien/Documents/donnees/projets/site-emploi-finance/java/cheetah/web/target/test-classes</testOutputDirectory>
<resources>
<resource>
<mergeId>resource-2</mergeId>
<directory>/home/julien/Documents/donnees/projets/site-emploi-finance/java/cheetah/web/src/main/java</directory>
<includes>
<include>**/*.tml</include>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<mergeId>resource-3</mergeId>
<directory>/home/julien/Documents/donnees/projets/site-emploi-finance/java/cheetah/web/src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<mergeId>resource-1</mergeId>
<directory>/home/julien/Documents/donnees/projets/site-emploi-finance/java/cheetah/web/src/test/resources</directory>
</testResource>
</testResources>
<directory>/home/julien/Documents/donnees/projets/site-emploi-finance/java/cheetah/web/target</directory>
<finalName>cheetah-web-1.0-SNAPSHOT</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-rar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-8</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.0.4</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
</plugin>
<plugin>
<artifactId>maven-help-plugin</artifactId>
<version>2.1.1</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>java.net</id>
<url>http://download.java.net/maven/1</url>
<layout>legacy</layout>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>jboss</id>
<name>jboss</name>
<url>http://repository.jboss.org/maven2/</url>
</repository>
<repository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<updatePolicy>never</updatePolicy>
</snapshots>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</pluginRepository>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>com.cheetah</groupId>
<artifactId>cheetah-domain</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.cheetah</groupId>
<artifactId>cheetah-service</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-core</artifactId>
<version>5.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-beanvalidator</artifactId>
<version>5.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-spring</artifactId>
<version>5.2.6</version>
</dependency>
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-test</artifactId>
<version>5.2.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.5.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>2.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<reporting>
<outputDirectory>/home/julien/Documents/donnees/projets/site-emploi-finance/java/cheetah/web/target/site</outputDirectory>
</reporting>
</project>
Running junit tests in maven requires minimal setup. Add junit to your dependencies:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
Create a class in src/test/java/com/cheetah/web/pages:
public class FooTest {
#Test
public void writingToStdOut_succeeds() throws Exception {
System.out.println("I work!");
}
}
Run mvn test. That's all. There's no need to configure anything in the surefire plugin. It's no different for a war project vs. a jar project. If you do these two things and it doesn't work, then something is misconfigured somewhere else, and we'll probably need to see the whole pom or, better yet, the effective pom to tell what's going on.
Note that Surefire will only run either testng tests or junit tests but not both in the same build.
Just to mention what everyone already knows, but what still catches me out every now and again. Remember that there is a naming convention to what tests will be "seen" and if you don't name the test class correctly, it is ignored.
running
mvn -X test
shows us (trimmed down):
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test' with basic configurator -->
[DEBUG] (s) additionalClasspathElements = []
...
[DEBUG] (s) excludes = [**/Abstract*.java]
[DEBUG] (s) includes = [**/*Tests.java, **/*Test.java]
So, by default, only classes ending "Test.java" or "Tests.java" will be picked up.
In my case problem was with maven version dependecy. I added it manually and I made a mistake.
Advise:
You should always add dependencies by "Insert Dependency" menu. It can be displayed by using shortcut "crtl"+"space" when your cursor is between <dependency> and </dependency> in your xml file. When you in "Select Dependency" menu enter "junit" in "Enter..." textbox and choose your version of junit. After clicking "ok" your dependency will be automatically added. This helps avoid problem with incorrect version typed manually.

Resources