You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by fhomasp <th...@realdolmen.com> on 2011/02/09 17:07:50 UTC

Breaking the build on JVM 6 because of maven dependency

Hey,

I'm using Maven 2.0.9.  Not by choice, if it matters.

Yesterday I took a project out of SVN which I built for the first time.  But
to my surprise the build failed, eventhough it's currently running on
several servers around here.  The reason for it?  A transitive dependency
that's different on Java 6 compared to Java 5.  I'm talking about
spring-ws-security: 1.5.7.  This has a dependency on org.apache.ws.security:
wss4j 1.5.7 which in turn seems to have a dependency on bouncycastle
bcprov-jdk14:140.  This only happens when I build the project using a Java 6
VM and even so when I build using source and target set on Java 5.

I must say that I was very surprised to see this kind of behaviour.  To
solve the problem I had to install a seperate Java 5 VM and set the maven
compiler to use it.  But...  Eventually my own written project will need to
be deployed on an Oracle 11g server which uses Java 6.  

Using an updated version of spring-ws-security is not a good solution and
that's out of my hands.

Any comments?

Thanks!
-- 
View this message in context: http://maven.40175.n5.nabble.com/Breaking-the-build-on-JVM-6-because-of-maven-dependency-tp3377821p3377821.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: Breaking the build on JVM 6 because of maven dependency

Posted by Jörg Schaible <jo...@scalaris.com>.
fhomasp wrote:

> 
> 
> I understand it was only an example :-)
> To clarify my question...  I build my war using a java 5 VM in maven2. 
> This
> means no bcprov or wss4j version as dependency in the libs of the war. 
> This
> seems to work fine.  So why are these dependencies added for java 6 then?
> Surely something must be available in java 5 which is not available
> anymore
> in java 6.

Look at dependency:tree running Maven with each JDK once to understand where 
the difference comes from.

> Unless of course the dependency is never used, then I'll
> probably feel better :-)

No, it simply means that the dependencies have been screwed up by that 
profile in this spring pom. If you build with Java 6 for a target Java 5 
runtime, you have to add the deps declared in the Java 5 profile of this 
spring pom manually. Those who generated that pom simply weren't aware of 
the problem they created. They simply assumed that you run your result on 
the same Java runtime you used to build your stuff. An obviously wrong 
assumption.

- Jörg


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


Re: Breaking the build on JVM 6 because of maven dependency

Posted by fhomasp <th...@realdolmen.com>.

I understand it was only an example :-)
To clarify my question...  I build my war using a java 5 VM in maven2.  This
means no bcprov or wss4j version as dependency in the libs of the war.  This
seems to work fine.  So why are these dependencies added for java 6 then? 
Surely something must be available in java 5 which is not available anymore
in java 6.  Unless of course the dependency is never used, then I'll
probably feel better :-)



Jörg Schaible-3 wrote:
> 
> fhomasp wrote:
> 
>> I see, thanks.  Though I can't seem to find any reference to *bcprov*
>> anywhere in the java 6 jre.  So the functionality is somehow imported in
>> Java 6 on the class level instead of relying on wss4j and bcprov then?
> 
> Rhino was only an example! The same happens if you depend in the profile
> for 
> Java 6 on dependency A and in the profile for Java 5 on dependency B. If A 
> and B have different dependencies themselves you get a complete different 
> set of jars for e.g. a webapp. This is what you're facing.
> 
> - Jörg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://maven.40175.n5.nabble.com/Breaking-the-build-on-JVM-6-because-of-maven-dependency-tp3377821p3379064.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: Breaking the build on JVM 6 because of maven dependency

Posted by Jörg Schaible <jo...@scalaris.com>.
fhomasp wrote:

> I see, thanks.  Though I can't seem to find any reference to *bcprov*
> anywhere in the java 6 jre.  So the functionality is somehow imported in
> Java 6 on the class level instead of relying on wss4j and bcprov then?

Rhino was only an example! The same happens if you depend in the profile for 
Java 6 on dependency A and in the profile for Java 5 on dependency B. If A 
and B have different dependencies themselves you get a complete different 
set of jars for e.g. a webapp. This is what you're facing.

- Jörg


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


Re: Breaking the build on JVM 6 because of maven dependency

Posted by fhomasp <th...@realdolmen.com>.

I see, thanks.  Though I can't seem to find any reference to *bcprov*
anywhere in the java 6 jre.  So the functionality is somehow imported in
Java 6 on the class level instead of relying on wss4j and bcprov then?

Cheers,
T


Jörg Schaible-3 wrote:
> 
> Hi,
> 
> fhomasp wrote:
> 
>> 
>> 
>> So different dependencies in different profiles are going to be
>> disallowed
>> then?  I do remember that you're not that much of a profile fan.  I fully
>> agree here.
>> 
>> So what might happen if I build a war with java 5 and deploy it on a
>> server using java 6?
> 
> Nothing :)
> 
> The problem is that the profile activation is happening on the Java
> version 
> used to build the current artifact and not based on the target runtime.
> E.g. 
> somebody decides that he uses a dependency to rhino only in a Java 5 
> profile, because it is included in Java 6. Now, if the project is build
> with 
> Java 6, but with built target Java 5, the rhino dependency will be missing 
> and you will not even notice it unless you actually try to run on a Java 5 
> runtime. If you've delivered a war referencing a dependency with such a 
> profile it might be simply broken.
> 
> Using deps in a profile can be convenient to build e.g. debug versions
> that 
> contain additional diagnostic stuff or support a special debug
> environment, 
> but in general it generates a lot of trouble if used with too less
> knowledge 
> about the consequences.
> 
> - Jörg
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://maven.40175.n5.nabble.com/Breaking-the-build-on-JVM-6-because-of-maven-dependency-tp3377821p3379028.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: Breaking the build on JVM 6 because of maven dependency

Posted by Jörg Schaible <jo...@scalaris.com>.
Hi,

fhomasp wrote:

> 
> 
> So different dependencies in different profiles are going to be disallowed
> then?  I do remember that you're not that much of a profile fan.  I fully
> agree here.
> 
> So what might happen if I build a war with java 5 and deploy it on a
> server using java 6?

Nothing :)

The problem is that the profile activation is happening on the Java version 
used to build the current artifact and not based on the target runtime. E.g. 
somebody decides that he uses a dependency to rhino only in a Java 5 
profile, because it is included in Java 6. Now, if the project is build with 
Java 6, but with built target Java 5, the rhino dependency will be missing 
and you will not even notice it unless you actually try to run on a Java 5 
runtime. If you've delivered a war referencing a dependency with such a 
profile it might be simply broken.

Using deps in a profile can be convenient to build e.g. debug versions that 
contain additional diagnostic stuff or support a special debug environment, 
but in general it generates a lot of trouble if used with too less knowledge 
about the consequences.

- Jörg



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


Re: Breaking the build on JVM 6 because of maven dependency

Posted by fhomasp <th...@realdolmen.com>.

So different dependencies in different profiles are going to be disallowed
then?  I do remember that you're not that much of a profile fan.  I fully
agree here.

So what might happen if I build a war with java 5 and deploy it on a server
using java 6?  

Thanks!
T


stephenconnolly wrote:
> 
> this is a result of somebody having put dependencies in a profile
> activated
> by java version.
> 
> a mistake was made when the pom schema was defined in allowing
> dependencies
> to be part of profiles.
> 
> it cannot be corrected until maven 3.1 or later
> 
> - Stephen
> 
> ---
> Sent from my Android phone, so random spelling mistakes, random nonsense
> words and other nonsense are a direct result of using swype to type on the
> screen
> On 9 Feb 2011 16:08, "fhomasp" <th...@realdolmen.com> wrote:
> 
> 

-- 
View this message in context: http://maven.40175.n5.nabble.com/Breaking-the-build-on-JVM-6-because-of-maven-dependency-tp3377821p3378957.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: Breaking the build on JVM 6 because of maven dependency

Posted by Stephen Connolly <st...@gmail.com>.
I'm saying it cannot be fixed/changed before 3.1.

I'm not saying whether it will be fixed/changed

re your other question, I'd need more details/example pom(s)

- Stephen

---
Sent from my Android phone, so random spelling mistakes, random nonsense
words and other nonsense are a direct result of using swype to type on the
screen
On 9 Feb 2011 20:48, "Greg Akins" <an...@gmail.com> wrote:
> On Wed, Feb 9, 2011 at 2:53 PM, Stephen Connolly
> <st...@gmail.com> wrote:
>> this is a result of somebody having put dependencies in a profile
activated
>> by java version.
>>
>> a mistake was made when the pom schema was defined in allowing
dependencies
>> to be part of profiles.
>
> Are you saying that in version 3.1 dependencies won't be allowed per
schema?
>
> I use that capability to make sure that some "debug" jars
> (specifically the Struts config-browser plugin) won't be included on a
> production deploy.
>
> Is there a better way to do that?
>
> --
> Greg Akins
> http://twitter.com/akinsgre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

Re: Breaking the build on JVM 6 because of maven dependency

Posted by Greg Akins <an...@gmail.com>.
On Wed, Feb 9, 2011 at 2:53 PM, Stephen Connolly
<st...@gmail.com> wrote:
> this is a result of somebody having put dependencies in a profile activated
> by java version.
>
> a mistake was made when the pom schema was defined in allowing dependencies
> to be part of profiles.

Are you saying that in version 3.1 dependencies won't be allowed per schema?

I use that capability to make sure that some "debug" jars
(specifically the Struts config-browser plugin) won't be included on a
production deploy.

Is there a better way to do that?

-- 
Greg Akins
http://twitter.com/akinsgre

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


Re: Breaking the build on JVM 6 because of maven dependency

Posted by Stephen Connolly <st...@gmail.com>.
this is a result of somebody having put dependencies in a profile activated
by java version.

a mistake was made when the pom schema was defined in allowing dependencies
to be part of profiles.

it cannot be corrected until maven 3.1 or later

- Stephen

---
Sent from my Android phone, so random spelling mistakes, random nonsense
words and other nonsense are a direct result of using swype to type on the
screen
On 9 Feb 2011 16:08, "fhomasp" <th...@realdolmen.com> wrote: