You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by thisguy <bo...@yahoo.com> on 2010/10/06 19:09:10 UTC

importing dependencies without inheritance

Hi, I have project A which is a jar.  Then I have project B which is a war.

In B's pom.xml I have a dependency on jar A.  However when the war is built
I am not getting A's dependency jars put into my WEB-INF/lib directory.

I don't want to setup B as a child project of A because they aren't really
related.  I realize I could manually add A's dependencies to my B's pom but
that seems like a lot of trouble.

Is my only option to do a fat jar for A?  I really don't want to do that.

To sum up: how can I get a dependency jar's dependencies into my
web-inf/lib?  Thank you.
-- 
View this message in context: http://maven.40175.n5.nabble.com/importing-dependencies-without-inheritance-tp3201744p3201744.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: importing dependencies without inheritance

Posted by thisguy <bo...@yahoo.com>.
The problem is now fixed and it was "user-error".  Thanks to everyone for
their suggestions.  The discussion about poms in the repository led me to
the answer.  I noticed the pom for one of my dependent jars was basically
blank and had been generated by nexus.  It was a minimal POM that included
no dependency information.  I couldn't figure out why until I tried
uploading the jar again.  Previously I had selected GAV instead of POM and I
entered my information manually.  So Nexus created a pom file for me that
ONLY included this information(no dependency information).  If I uploaded
the project pom file instead, Nexus puts that file in the right place in the
repository.  Once I did that I could see my correct pom in the repository. 
I deleted my local cache, rebuilt indexes and all that, and now project B is
pulling in all the dependencies' dependencies correctly.  Thanks again for
your help!
-- 
View this message in context: http://maven.40175.n5.nabble.com/importing-dependencies-without-inheritance-tp3201744p3203200.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: importing dependencies without inheritance

Posted by Wayne Fay <wa...@gmail.com>.
> into Nexus anyway.  The build process builds two jars one with and one
> without dependencies.  I uploaded the myjar without dependencies into Nexus.
> That is the one that is included in project B's web-inf/lib (but not its
> dependencies) which I have verified.  Sorry for the confusion.

So, did you fix your problem, or still having problems? I'm unsure.

I'd look at the pom that got deployed and see what its dependency list
looks like. Its very possible the jar-with-deps pushed a pom out into
your repo that has no deps... since it doesn't have any. And that's
what B is picking up during its build.

Stuff like this makes me say "don't use classifiers" since the
classified artifact still shares the pom with the unclassified one,
which can lead to troubles like this one...

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: importing dependencies without inheritance

Posted by thisguy <bo...@yahoo.com>.
Yes I'm aware it builds a jar with dependencies..that is because I couldn't
figure out how to solve this the right way which is why I'm asking you guys. 
Pay no attention to that plugin part..I didn't check in that particular jar
into Nexus anyway.  The build process builds two jars one with and one
without dependencies.  I uploaded the myjar without dependencies into Nexus. 
That is the one that is included in project B's web-inf/lib (but not its
dependencies) which I have verified.  Sorry for the confusion.
-- 
View this message in context: http://maven.40175.n5.nabble.com/importing-dependencies-without-inheritance-tp3201744p3201986.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: importing dependencies without inheritance

Posted by Wayne Fay <wa...@gmail.com>.
>                <artifactId>maven-assembly-plugin</artifactId>
>                <version>2.2-beta-5</version>
>                <configuration>
>                  <descriptorRefs>
>                    <descriptorRef>jar-with-dependencies</descriptorRef>

You do realize what this plugin with that configuration does, right...?

Wayne

Re: importing dependencies without inheritance

Posted by Ron Wheeler <rw...@artifact-software.com>.
  The POMs look good to me.
I would move the <repositories/> to a parent POM with the compile 
plug-in just to reduce the size of the project POMs but that is not what 
is affecting your build.

Log from the build of B ?

Ron


On 06/10/2010 3:37 PM, thisguy wrote:
> ok I've pruned out the rest of the dependencies but left everything else in
> here:
>
> Project A:
>
> <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>myorg</groupId>
>    <artifactId>myjar</artifactId>
>    <version>1.0.0.0</version>
>    <name>myjar</name>
>    <repositories>
>    	<repository>
>    		<id>public</id>
>    		<url>http://blah:8081/nexus/content/groups/public/</url>
>    	</repository>
>    </repositories>
> <dependencies>
>
> <dependency>
>    		<groupId>postgresql</groupId>
>    		<artifactId>postgresql</artifactId>
>    		<version>8.2-507.jdbc3</version>
>    		<type>jar</type>
>    		<scope>compile</scope>
>    	</dependency>
> </dependencies>
>   <properties>
>      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>    </properties>
>     <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>
> 				</configuration>
>    		</plugin>
>    		<plugin>
> 	<artifactId>maven-assembly-plugin</artifactId>
> 	<version>2.2-beta-5</version>
> 	<configuration>
> 	<descriptorRefs>
> 	<descriptorRef>jar-with-dependencies</descriptorRef>
> 	</descriptorRefs>
> 	</configuration>
> 	<executions>
>            <execution>
>              <id>make-my-jar-with-dependencies</id>
>              <phase>package</phase>
>              <goals>
>                <goal>single</goal>
>              </goals>
>            </execution>
>          </executions>
> 	
> 	  	</plugin>	
>    	</plugins>
>
> Then in project B:
>
> <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>myorg</groupId>
>    <artifactId>mywebapp</artifactId>
>    <version>1.0.0.0</version>
> <packaging>war</packaging>
>    <name>mywebapp</name>
>    <repositories>
>    	<repository>
>    		<id>public</id>
>    		<url>http://blah:8081/nexus/content/groups/public/</url>
>    	</repository>
>    </repositories>
>    <dependencies>
> 	<dependency>
> 	  		<groupId>myorg</groupId>
> 	  		<artifactId>myjar</artifactId>
> 	  		<version>1.0.0.0</version>
> 	  		<type>jar</type>
> 	  		<scope>compile</scope>
> 	  	</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>
> 				</configuration>
>    		</plugin>
>    	</plugins>
>    </build>
>
>    <properties>
>      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>    </properties>
> </project>
>
> I don't have the log from maven install because I manually uploaded the
> "myjar" into nexus.  Eclipse found it ok so I assumed it is fine in the
> repository.  Let me know if I should look for something in particular in the
> POM generated by nexus or whatever.  Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: importing dependencies without inheritance

Posted by thisguy <bo...@yahoo.com>.
ok I've pruned out the rest of the dependencies but left everything else in
here:

Project A:

<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>myorg</groupId>
  <artifactId>myjar</artifactId>
  <version>1.0.0.0</version>
  <name>myjar</name>
  <repositories>
  	<repository>
  		<id>public</id>
  		<url>http://blah:8081/nexus/content/groups/public/</url>
  	</repository>
  </repositories>
<dependencies>

<dependency>
  		<groupId>postgresql</groupId>
  		<artifactId>postgresql</artifactId>
  		<version>8.2-507.jdbc3</version>
  		<type>jar</type>
  		<scope>compile</scope>
  	</dependency>
</dependencies>
 <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
   <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>
				</configuration>
  		</plugin>
  		 <plugin>
	        <artifactId>maven-assembly-plugin</artifactId>
	        <version>2.2-beta-5</version>
	        <configuration>
	          <descriptorRefs>
	            <descriptorRef>jar-with-dependencies</descriptorRef>
	          </descriptorRefs>
	        </configuration>
	        <executions>
          <execution>
            <id>make-my-jar-with-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
	        
	  	</plugin>	
  	</plugins>

Then in project B:

<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>myorg</groupId>
  <artifactId>mywebapp</artifactId>
  <version>1.0.0.0</version>
<packaging>war</packaging>
  <name>mywebapp</name>
  <repositories>
  	<repository>
  		<id>public</id>
  		<url>http://blah:8081/nexus/content/groups/public/</url>
  	</repository>
  </repositories>
  <dependencies>
	  <dependency>
	  		<groupId>myorg</groupId>
	  		<artifactId>myjar</artifactId>
	  		<version>1.0.0.0</version>
	  		<type>jar</type>
	  		<scope>compile</scope>
	  	</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>
				</configuration>
  		</plugin>
  	</plugins>
  </build>
  
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>

I don't have the log from maven install because I manually uploaded the
"myjar" into nexus.  Eclipse found it ok so I assumed it is fine in the
repository.  Let me know if I should look for something in particular in the
POM generated by nexus or whatever.  Thanks.
-- 
View this message in context: http://maven.40175.n5.nabble.com/importing-dependencies-without-inheritance-tp3201744p3201964.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: importing dependencies without inheritance

Posted by Ron Wheeler <rw...@artifact-software.com>.
  On 06/10/2010 2:54 PM, thisguy wrote:
> ok this is from project B's pom.xml
>
> <dependency>
> 	  		<groupId>hello</groupId>
> 	  		<artifactId>myjar</artifactId>
> 	  		<version>1.0.0.0</version>
> 	  		<type>jar</type>
> 	  		<scope>compile</scope>
> 	  	</dependency>
>
> this jar does get put into web-inf/lib but the jars that myjar depends on do
> not.  Here is an example from project A's pom:
>
> <dependency>
>    		<groupId>postgresql</groupId>
>    		<artifactId>postgresql</artifactId>
>    		<version>8.2-507.jdbc3</version>
>    		<type>jar</type>
>    		<scope>compile</scope>
>    	</dependency>
>
> I would expect to see this jar in web-inf/lib since myjar depends on it.
>
> Thank you.
Looks OK to me.
The error must be in another part of your POM.
Can you post the whole POM and the log from the maven install?

The good thing is that you are doing what you are supposed to be doing 
and maven will do what you want.
You have made an error somewhere and once you fix it, you will be on 
your way again.

Ron

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: importing dependencies without inheritance

Posted by thisguy <bo...@yahoo.com>.
ok this is from project B's pom.xml

<dependency>
	  		<groupId>hello</groupId>
	  		<artifactId>myjar</artifactId>
	  		<version>1.0.0.0</version>
	  		<type>jar</type>
	  		<scope>compile</scope>
	  	</dependency>

this jar does get put into web-inf/lib but the jars that myjar depends on do
not.  Here is an example from project A's pom:

<dependency>
  		<groupId>postgresql</groupId>
  		<artifactId>postgresql</artifactId>
  		<version>8.2-507.jdbc3</version>
  		<type>jar</type>
  		<scope>compile</scope>
  	</dependency>

I would expect to see this jar in web-inf/lib since myjar depends on it.

Thank you.
-- 
View this message in context: http://maven.40175.n5.nabble.com/importing-dependencies-without-inheritance-tp3201744p3201893.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: importing dependencies without inheritance

Posted by Ron Wheeler <rw...@artifact-software.com>.
  On 06/10/2010 1:09 PM, thisguy wrote:
> Hi, I have project A which is a jar.  Then I have project B which is a war.
>
> In B's pom.xml I have a dependency on jar A.  However when the war is built
> I am not getting A's dependency jars put into my WEB-INF/lib directory.
>
> I don't want to setup B as a child project of A because they aren't really
> related.  I realize I could manually add A's dependencies to my B's pom but
> that seems like a lot of trouble.
>
> Is my only option to do a fat jar for A?  I really don't want to do that.
>
> To sum up: how can I get a dependency jar's dependencies into my
> web-inf/lib?  Thank you.

This is pretty standard.

How have you defined the dependency?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org