You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by agent59624285 <ag...@spamcorptastic.com> on 2009/03/13 18:06:09 UTC

maven adding wrong jar files in war lib

The jar file listed on "mvn dependency:tree" and jar files inside the war
file are different.

If I create an empty project and use the pom file the maven packages the
correct jar files, otherwise it adds about 7 extra jar files which makes my
webapp fail when I deploy it in jboss. But if I copy the correct jar files
created by the empty project with the original pom file, everything works
fine in jboss.

I am using hibernate, spring, and jaxb. The jar files added by maven during
package phase are asm, asm-attrs, xml-apis, ..

Is there a way to make maven stop adding extra jar files?

Thanks, 

Let me know if I need to attach pom file


-- 
View this message in context: http://www.nabble.com/maven-adding-wrong-jar-files-in-war-lib-tp22500900p22500900.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: maven adding wrong jar files in war lib

Posted by agent59624285 <ag...@spamcorptastic.com>.
Thank you all.

I had done something stupid. I had copied the some jar files inside the
WEB-INF/lib folder to do debugging on jetty on the project. Later I figured
out how to do debugging on jetty using pom. I totally forgot about the jar
files in the lib folder ...

Thanks 
-- 
View this message in context: http://www.nabble.com/maven-adding-wrong-jar-files-in-war-lib-tp22500900p22561624.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: maven adding wrong jar files in war lib

Posted by Baptiste MATHUS <ml...@batmat.net>.
No, you don't. Scope mgmt is standard and built-in.

I really can't see how sources could have an impact on the libraries in the
final war file :-/.
I see you're using build-helper-plugin, could you temporarily disable it to
see if it changes anything?

Cheers.

2009/3/16 agent59624285 <ag...@spamcorptastic.com>

>
> Yes, I am using mvn clean package
>
> To find out where the asm dependency was coming from. I changed the scope
> of
> all dependency entries to provided, but I am still seeing all the jar files
> (except serverlet-api) in side the lib folder in the war file.
>
> If <scope>provided</scope>  is added to dependency, shouldn't it be not
> added in the lib folder of the war file when you do "mvn clean package"? Do
> you need a separate plugin for it to work?
>
> Thanks
>


-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Re: maven adding wrong jar files in war lib

Posted by agent59624285 <ag...@spamcorptastic.com>.
Yes, I am using mvn clean package

To find out where the asm dependency was coming from. I changed the scope of
all dependency entries to provided, but I am still seeing all the jar files
(except serverlet-api) in side the lib folder in the war file.

If <scope>provided</scope>  is added to dependency, shouldn't it be not
added in the lib folder of the war file when you do "mvn clean package"? Do
you need a separate plugin for it to work?

Thanks

-- 
View this message in context: http://www.nabble.com/maven-adding-wrong-jar-files-in-war-lib-tp22500900p22540300.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: maven adding wrong jar files in war lib

Posted by Wayne Fay <wa...@gmail.com>.
> I have no idea how asm libraries are coming from. list, tree, etc does not
> list the asm dependency
> from any libraries. I am using m2eclipse, and none of its dependency view
> shows asm

Are you using "mvn clean package" or what?

It is possible that asm and other libs landed in target a while ago,
accidentally, and simply never got cleaned.

Wayne

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


Re: maven adding wrong jar files in war lib

Posted by agent59624285 <ag...@spamcorptastic.com>.
Thanks Wayne and Mathus,

I tried both of your suggestion but it did not help me. Here is the link to
the diff file
http://pastebin.com/m28d5480f http://pastebin.com/m28d5480f 

I deleted the oracle dependency, and I am still experiencing the same
problem.

On the new pom file, I added hibernate and added asm to exclusion tag, but
it is still pulling asm jar file and xml-apis jar file if the source code is
present. 

I have no idea how asm libraries are coming from. list, tree, etc does not
list the asm dependency
from any libraries. I am using m2eclipse, and none of its dependency view
shows asm

http://www.nabble.com/file/p22528118/pom.xml pom.xml 
http://www.nabble.com/file/p22528118/diff1.JPG diff1.JPG 


-- 
View this message in context: http://www.nabble.com/maven-adding-wrong-jar-files-in-war-lib-tp22500900p22528118.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: maven adding wrong jar files in war lib

Posted by Wayne Fay <wa...@gmail.com>.
> But when my source code is present, it adds asm-1.5.3.jar,
> asm-attrs-1.5.3.jar, cglib-2.1_3.jar,xml-apis-1.0.b2.jar, .. etc .. (as I
> said previously, these libraries crashes jboss server instance in staging.
> If I take the jar files generated by empty project, then everything works
> fine)

I just used your pom and ran "mvn package" in an otherwise empty
project (though I added web.xml in the proper place). None of those
libraries showed up in /target nor in the resulting war. Of course, I
don't have your source code so I can't test with that.

One thing I'll mention -- I don't have ojdbc14 installed, and you
could have arguably built your own pom for that artifact which
includes the asm, cglib, etc jars as dependencies, which might result
in the problems you describe. You may want to consider using
com.oracle/ojdbc14/10.2.0.2.0 since that pom is available in Central
(no jar, of course).

You could run "mvn -X" with no source and again with source, then run
diff against the two outputs and try to locate the differences. Then
post the diffs at pastebin.com and someone might be able to offer a
suggestion.

Wayne

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


Re: maven adding wrong jar files in war lib

Posted by agent59624285 <ag...@spamcorptastic.com>.
I have attached the pom file.
If I generate war file from an empty project (without any source code), I
get correct jar files in the war file.
But when my source code is present, it adds asm-1.5.3.jar,
asm-attrs-1.5.3.jar, cglib-2.1_3.jar,xml-apis-1.0.b2.jar, .. etc .. (as I
said previously, these libraries crashes jboss server instance in staging.
If I take the jar files generated by empty project, then everything works
fine)

dependency:list also does not list asm libraries as dependency. Is this a
common problem?




Baptiste MATHUS-4 wrote:
> 
> Dependency:tree shows every jars transitively. If you want to compare the
> war content and something other, use dependency:list instead.
> 
> Anyway, which jar is listed in the dependency:tree that you think should
> be
> included in the war and isn't?
> Please show us the corresponding <dependency> block part from your pom AND
> the dependency:tree part, for the dependency that's problematic for you.
> 
> Cheers.
> 
> 2009/3/13 agent59624285 <ag...@spamcorptastic.com>
> 
>>
>> The jar file listed on "mvn dependency:tree" and jar files inside the war
>> file are different.
>>
>> If I create an empty project and use the pom file the maven packages the
>> correct jar files, otherwise it adds about 7 extra jar files which makes
>> my
>> webapp fail when I deploy it in jboss. But if I copy the correct jar
>> files
>> created by the empty project with the original pom file, everything works
>> fine in jboss.
>>
>> I am using hibernate, spring, and jaxb. The jar files added by maven
>> during
>> package phase are asm, asm-attrs, xml-apis, ..
>>
>> Is there a way to make maven stop adding extra jar files?
>>
>> Thanks,
>>
>> Let me know if I need to attach pom file
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/maven-adding-wrong-jar-files-in-war-lib-tp22500900p22500900.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
>>
>>
> 
> 
> -- 
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor !
> 
> 
http://www.nabble.com/file/p22519847/pom.xml pom.xml 
-- 
View this message in context: http://www.nabble.com/maven-adding-wrong-jar-files-in-war-lib-tp22500900p22519847.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: maven adding wrong jar files in war lib

Posted by Baptiste MATHUS <ml...@batmat.net>.
Dependency:tree shows every jars transitively. If you want to compare the
war content and something other, use dependency:list instead.

Anyway, which jar is listed in the dependency:tree that you think should be
included in the war and isn't?
Please show us the corresponding <dependency> block part from your pom AND
the dependency:tree part, for the dependency that's problematic for you.

Cheers.

2009/3/13 agent59624285 <ag...@spamcorptastic.com>

>
> The jar file listed on "mvn dependency:tree" and jar files inside the war
> file are different.
>
> If I create an empty project and use the pom file the maven packages the
> correct jar files, otherwise it adds about 7 extra jar files which makes my
> webapp fail when I deploy it in jboss. But if I copy the correct jar files
> created by the empty project with the original pom file, everything works
> fine in jboss.
>
> I am using hibernate, spring, and jaxb. The jar files added by maven during
> package phase are asm, asm-attrs, xml-apis, ..
>
> Is there a way to make maven stop adding extra jar files?
>
> Thanks,
>
> Let me know if I need to attach pom file
>
>
> --
> View this message in context:
> http://www.nabble.com/maven-adding-wrong-jar-files-in-war-lib-tp22500900p22500900.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
>
>


-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Re: maven adding wrong jar files in war lib

Posted by agent59624285 <ag...@spamcorptastic.com>.
I can use mvn dependency:copy-dependencies -DincludeScope=compile
(http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html)

to get the correct jar files that I want, but I don't know how to delete the
jar files from  the war file and replace it with the ones generated by the
above command.


shouldn't the plugin below produce the same output as the output generated
by command above??

     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
             
<outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
<includeScope>compile</includeScope>
            </configuration>
          </execution>
        </executions>
      </plugin>

-- 
View this message in context: http://www.nabble.com/maven-adding-wrong-jar-files-in-war-lib-tp22500900p22501463.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: maven adding wrong jar files in war lib

Posted by agent59624285 <ag...@spamcorptastic.com>.
Thank you all.

I had done something stupid. I had copied the some jar files inside the
WEB-INF/lib folder to do debugging on jetty on the project. Later I figured
out how to do debugging on jetty using pom. I totally forgot about the jar
files in the lib folder ...

Thanks
-- 
View this message in context: http://www.nabble.com/maven-adding-wrong-jar-files-in-war-lib-tp22500900p22561567.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