File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes jars in the custom ear not getting referenced at compile time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "jars in the custom ear not getting referenced at compile time" Watch "jars in the custom ear not getting referenced at compile time" New topic
Author

jars in the custom ear not getting referenced at compile time

partha sarathi samantaray
Greenhorn

Joined: Oct 16, 2008
Posts: 7
Hi guys,
please help me in getting the solution.
1) i had put many jars like struts1.2.9.jar , junti.jar etc in a lib folder. then make it as colib.ear.
2) Then try to install as
mvn install:install-file ���DgroupId=repackage.oracle.ebilling ���DartifactId=colib ���Dversion=6.0 ���Dpackaging=ear ���Dfile=colib.EAR

3) Then I found colib-6.0.EAR has been created in my repository as repo3\repackage\oracle\ebilling\ebilling\6.0\ colib-6.0.EAR

4) when i tried to compile with mvn packaging it gives that package org.apache.struts.action does not exist , though it is in the colib-6.0.ear. as it does not found the jars in the classpath
5) my pom file as below. and i have attached the pom file.
i have mentioned that in dependancy tag.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>root.project</groupId>
<artifactId>practice-war</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>test-webapp</name>
<dependencies>
<dependency>
<groupId>repackage.oracle.ebilling</groupId>
<artifactId>colib</artifactId>
<version>6.0</version>
<type>ear</type>
<scope>provided</scope>
</dependency>

</dependencies>
<build>
<directory>target</directory>
<outputDirectory>target/classes</outputDirectory>
<finalName>maven2example_testfinalweb</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>$\{basedir\}/ebilling</directory>
<targetPath>ebilling</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<!-- <fork>true</fork> -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin><groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<dependentWarIncludes>**/images</dependentWarIncludes>
<dependentWarExcludes>WEB-INF/web.xml,index.*</dependentWarExcludes>
<workDirectory>target/war/work</workDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>auto-clean</id>
<phase>validate</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dependency-maven-plugin</artifactId>
<executions>
<execution>
<id>unpack-eBilling-App</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>repackage.oracle.ebilling</groupId>
<artifactId>colib</artifactId>
<version>6.0</version>
<type>ear</type>
</artifactItem>
</artifactItems>
<outputDirectory></outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<displayName>eBilling App</displayName>
<description>(C)Copyright 1999-2007 Oracle(R), Inc. All Rights Reserved.</description>
<version>6.0</version>
<earSourceDirectory>${project.build.directory}/dependency</earSourceDirectory>
<applicationXml>${project.build.directory}/dependency/META-INF/application.xml
</applicationXml>
<generateApplicationXml>false</generateApplicationXml>
<modules>
<!-- List Of Jar which is included inside the Lib Dir -->
<jarModule>
<groupId>repackage.oracle.ebilling</groupId>
<artifactId>colib</artifactId>
<bundleDir>lib</bundleDir>
</jarModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Maybe I am misunderstanding something (or perhaps it is that your pom is not within code tags making it hard to read), but from what I see you are attempting to build using the EAR file as a dependency. You cannot do this - an EAR is not a JAR file, you cannot use an EAR as a compile dependency. If the compilation requires the struts classes, you need to mention them in your dependencies. At least, that is my understanding.


JBoss In Action
 
GeeCON Prague 2014
 
subject: jars in the custom ear not getting referenced at compile time