There are ways to do this. Bundling everything in an EAR and expecting it to work is not one of them.
One way to do this would be to create a separate project with packaging "pom" and then specify all the dependencies there (individually). Then in your ear project, add a <dependency> on that project with packaging "pom". If some of your dependencies are not available in the Maven repo, you will need to add them with "mvn install:install-file". But this is not always the right solution. Surely all of your projects do not require the exact same 50+ jars. Such a coarse approach to dependencies is not advisable for the long-term, generally. Wayne On Thu, Oct 16, 2008 at 1:01 AM, partha_ctc <[EMAIL PROTECTED]> wrote: > > Hi, > if i have lots of jars and rather than mentioning eah arifacts there > should be one approach to bundle many jar in some jar or war and getting the > reference in the dependancy tag. > > Wayne Fay wrote: >> >> Your approach will not work. The Java compiler does not know how to >> find compiled Java classes inside Jars inside Ears. Effectively, you >> cannot depend on an EAR in another project. >> >> Instead, you need to depend directly on the Struts artifacts in this >> project. >> >> There may be a way to make this work with transitive dependencies but >> since you constructed the EAR file manually, that is not an option for >> you either. >> >> Wayne >> >> On Wed, Oct 15, 2008 at 11:45 PM, partha_ctc >> <[EMAIL PROTECTED]> wrote: >>> >>> 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. >>> >>> <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> >>> >>> >>> >>> http://www.nabble.com/file/p20008047/pom.xml pom.xml >>> -- >>> View this message in context: >>> http://www.nabble.com/jars-in-the-custom-ear-not-getting-referenced-at-compile-time-tp20008047p20008047.html >>> Sent from the Maven - Users mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >> > > -- > View this message in context: > http://www.nabble.com/jars-in-the-custom-ear-not-getting-referenced-at-compile-time-tp20008047p20008970.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
