Re: Recommendations to resolve artifact/version fubar

2012-06-03 Thread Stephen Connolly
the convention for an artifact containing deprectated classes is to
give it the artifactId foo-deprecated or foo-legacy

Please strongly consider following that convention rather than going
with foo.dep

On 2 June 2012 01:29, Rolf Lear j...@tuis.net wrote:
 Hi again everyone.

 I have taken some time and installed a nexus locally, and I have been
 playing with different alternatives for how to solve my problem

 To recap, I have JDOM versions 1.x and 2.x both currently deployed in the
 artifact 'jdom' even though these versions internally have different
 packages (org.jdom.* and org.jdom2.* ). The problem is that it is necessary
 in some conditions to have both version 1.x and 2.x in a maven project
 (typically because the 1.x version is used by some third-party dependency).

 I have been trying to find the 'best' way to 'recover' the mess in the JDOM
 artifact so that it is possible to have both 1.x as well as 2.x, but to do
 it in such a way that it has the least impact on current users, and for
 those users who *need* both versions, it can be done as simply as possible.

 In my experimentation I think I have found that the *easiest* and also the
 *neatest* solution is to duplicate the latest JDOM 1.x artifact with a
 different artifact-id. In my local nexus I have duplicated the JDOM 1.1.3
 artifact as jdom.dep 1.1.3.

 The way I see this working is that for the 'simple' user, they do not have
 the complicated requirement to have both 1.x and 2.x. In their case they can
 just continue doing what they do and when they are ready they can
 upgrade their code to use JDOM 2.x, changing their dependency from jdom 1.x
 to jdom 2.x when they do.

 For the complicated user, they will be needing both versions. Right now they
 can't run their code because they can't have both 1.x and 2.x in their
 compile. In the typical case there is a third-party dependency which in turn
 depends on jdom 1.x. Since 'our' project depends on jdom 2.x and the 3rd
 party depends on 1.x, maven will automatically just pull the 'newer' jdom
 2.x version. This means that the 3rd-party code will be failing because it
 is missing classes.

 In this case, we can simply add the 'jdom.dep' artifact to our project,
 specifying the 1.x version.

 I have 'worked through' the various scenarios, and I think it can be
 expressed as follows:

 Say I have my project. It has the simple dependency:


    dependency
      groupIdorg.jdom/groupId
      artifactIdjdom/artifactId
      version2.0.1/version
      scopecompile/scope
    /dependency

 Now I want to include the additional dependency (this is just some
 'arbitrary' dependency which has an internal dependency to jdom 1.1):

    dependency
      groupIdnet.sourceforge.htmlcleaner/groupId
      artifactIdhtmlcleaner/artifactId
      version2.2/version
    /dependency

 Unfortunately this htmlcleaner code will not work because I am missing the
 org.jdom.* classes because maven has only used the jdom 2.0.1 version which
 only has the org.jdom2.* classes.

 The solution is, in my project, to also include the 'duplicate' 1.x
 dependency:

    dependency
      groupIdorg.jdom/groupId
      artifactIdjdom.dep/artifactId
      version1.1.3/version
    /dependency


 The bottom line is that only those people who require both versions will be
 affected, and the solution only requires adding a new dependency to the
 project, and there is no need to do 'exclusions' or other 'shady' logic

 Further, there is no need for the 'normal' JDOM user (they only require the
 one version of JDOM) to worry about anything because things just stay the
 same there is nothing to change.

 I would greatly appreciate it if this 'plan' could be inspected and
 criticized/poked/verified/etc.

 Thanks in advance

 Rolf




 On 29/05/2012 11:38 AM, Rolf Lear wrote:


 On Tue, 29 May 2012 16:22:27 +0100, Stephen Connolly
 stephen.alan.conno...@gmail.com  wrote:

 On 29 May 2012 15:26, Rolf Learj...@tuis.net  wrote:



 So, being inexperienced, my intention is to find some solution that:

 1. makes it possible (even if playing exclusion games is needed) to use
 both JDOM 1.x and 2.x in a maven project (currently it is not).


 Well actually it is possible to work around the issue if you are
 prepared to introduce a wrapper project...

 something like this:



 Hmmm... this has gone over my head I think I am going to have to spend
 some time getting to grips with some of the more details in maven...

 Perhaps I should take a few days and set up my own repo, and try these
 things out...

 For what it's worth, I am not sure the maven-shade-plugin is
 appropriate is it? I am not sure how that usage of it helps... I
 simply
 don't know enough.

 Bottom line is that I don't know enough yet... must learn more.

 Thanks all, I'll figure some more things out and come back with 'more of a
 clue'.

 Rolf



 -
 To unsubscribe, e-mail: 

Fwd: maven dependency plugin and maven 3

2012-06-03 Thread Anthony Dahanne
Hello  all,
sorry to bump ... :-(
but I'm still having issues understanding what's wrong with the maven
dependency plugin and maven 3...
I attached a pom to demonstrate the problem :
Using maven 3,
1) do a mvn package
2) then do a mvn
org.apache.maven.plugins:maven-dependency-plugin:2.4:purge-local-repository
-Dverbose=true   -DresolutionFuzziness=version -U

You will see the following output :
[INFO] --- maven-dependency-plugin:2.4:purge-local-repository
(default-cli) @ pof ---
[WARNING] Missing POM for javax.servlet:servlet-api:jar:2.5
[INFO] Skipping: pof. It cannot be resolved.
[INFO] Nothing to do for project: net.dahanne:pof:jar:1.0.0-SNAPSHOT

But I can tell you javax.servlet:servlet-api:jar:2.5 has a pom, and is
already installed in the local maven repository.

Could you guys share some light on this ? I think the maven dependency
plugin is not working fine with maven 3 , as opposed to what the
documentation says :
 https://cwiki.apache.org/MAVEN/maven-3x-plugin-compatibility-matrix.html

Thanks,
Anthony


-- Forwarded message --
From: Anthony Dahanne anthony.daha...@gmail.com
Date: Thu, May 31, 2012 at 5:50 PM
Subject: maven dependency plugin and maven 3
To: users@maven.apache.org


Hello all,
I'm only using maven 3 on my machine (be it command line or m2e).
I tried to use the maven dependency plugin on a project,

mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:purge-local-repository
-Dverbose=true   -DresolutionFuzziness=version

and it printed such warnings :

[WARNING] Missing POM for javax.servlet:servlet-api:jar:2.5
[WARNING] Missing POM for org.easymock:easymock:jar:3.0
[WARNING] Missing POM for junit:junit:jar:4.8.2

before telling me that the build was successful.
Thing is, it did not purge anything from my repo; because of those
warnings actually; launching the same command with -X, I could see :
[DEBUG] Verifying availability of
/Users/anthony/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
from []
[WARNING] Missing POM for javax.servlet:servlet-api:jar:2.5: Error
resolving project artifact: Could not find artifact
javax.servlet:servlet-api:pom:2.5 for project
javax.servlet:servlet-api:pom:2.5
[DEBUG]   javax.servlet:servlet-api:jar:2.5:provided (selected for provided)

and... I can tell you
/Users/anthony/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
exists and contains :
project
 modelVersion4.0.0/modelVersion
 groupIdjavax.servlet/groupId
 artifactIdservlet-api/artifactId
 version2.5/version
/project

Debugging the code a little, I could notice that this goal was using
org.apache.maven.artifact.resolver.DefaultArtifactResolver#resolveTransitively
from maven-artifact-manager 2.0.9 to find the dependencies.

I am wondering if this plugin failed purging my dependencies because
it used a maven 2 library to scan the dependencies, and my local repo
has only been built and used by mvn3 (and the repo metadata/layout
could be different to what this plugin was expecting) ..
Any thoughts ?
thanks a lot in advance
Anthony
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;
  modelVersion4.0.0/modelVersion


  groupIdnet.dahanne/groupId
  artifactIdpof/artifactId
  version1.0.0-SNAPSHOT/version

  dependencies
dependency
  groupIdnet.dahanne.gallery/groupId
  artifactIdcommons-gallery/artifactId
  version2.1.0-SNAPSHOT/version
/dependency
dependency
groupIdjavax.servlet/groupId
artifactIdservlet-api/artifactId
version2.5/version
  /dependency

  /dependencies

  repositories
repository
  iddahanne-snapshots/id
  urlhttp://nexus.dahanne.net/nexus/content/repositories/snapshots//url
/repository  
repository
  iddahanne-releases/id
  urlhttp://nexus.dahanne.net/nexus/content/repositories/releases//url
/repository
  /repositories
  
/project


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

Re: maven dependency plugin and maven 3

2012-06-03 Thread Jason van Zyl
You need to make a test case so we can reproduce it. It's impossible to tell 
whether it's you, your environment, the dependency plugin or Maven itself from 
looking at the textual output of the build.

On Jun 3, 2012, at 11:42 AM, Anthony Dahanne wrote:

 Hello  all,
 sorry to bump ... :-(
 but I'm still having issues understanding what's wrong with the maven
 dependency plugin and maven 3...
 I attached a pom to demonstrate the problem :
 Using maven 3,
 1) do a mvn package
 2) then do a mvn
 org.apache.maven.plugins:maven-dependency-plugin:2.4:purge-local-repository
 -Dverbose=true   -DresolutionFuzziness=version -U
 
 You will see the following output :
 [INFO] --- maven-dependency-plugin:2.4:purge-local-repository
 (default-cli) @ pof ---
 [WARNING] Missing POM for javax.servlet:servlet-api:jar:2.5
 [INFO] Skipping: pof. It cannot be resolved.
 [INFO] Nothing to do for project: net.dahanne:pof:jar:1.0.0-SNAPSHOT
 
 But I can tell you javax.servlet:servlet-api:jar:2.5 has a pom, and is
 already installed in the local maven repository.
 
 Could you guys share some light on this ? I think the maven dependency
 plugin is not working fine with maven 3 , as opposed to what the
 documentation says :
 https://cwiki.apache.org/MAVEN/maven-3x-plugin-compatibility-matrix.html
 
 Thanks,
 Anthony
 
 
 -- Forwarded message --
 From: Anthony Dahanne anthony.daha...@gmail.com
 Date: Thu, May 31, 2012 at 5:50 PM
 Subject: maven dependency plugin and maven 3
 To: users@maven.apache.org
 
 
 Hello all,
 I'm only using maven 3 on my machine (be it command line or m2e).
 I tried to use the maven dependency plugin on a project,
 
 mvn 
 org.apache.maven.plugins:maven-dependency-plugin:2.4:purge-local-repository
 -Dverbose=true   -DresolutionFuzziness=version
 
 and it printed such warnings :
 
 [WARNING] Missing POM for javax.servlet:servlet-api:jar:2.5
 [WARNING] Missing POM for org.easymock:easymock:jar:3.0
 [WARNING] Missing POM for junit:junit:jar:4.8.2
 
 before telling me that the build was successful.
 Thing is, it did not purge anything from my repo; because of those
 warnings actually; launching the same command with -X, I could see :
 [DEBUG] Verifying availability of
 /Users/anthony/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
 from []
 [WARNING] Missing POM for javax.servlet:servlet-api:jar:2.5: Error
 resolving project artifact: Could not find artifact
 javax.servlet:servlet-api:pom:2.5 for project
 javax.servlet:servlet-api:pom:2.5
 [DEBUG]   javax.servlet:servlet-api:jar:2.5:provided (selected for provided)
 
 and... I can tell you
 /Users/anthony/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
 exists and contains :
 project
  modelVersion4.0.0/modelVersion
  groupIdjavax.servlet/groupId
  artifactIdservlet-api/artifactId
  version2.5/version
 /project
 
 Debugging the code a little, I could notice that this goal was using
 org.apache.maven.artifact.resolver.DefaultArtifactResolver#resolveTransitively
 from maven-artifact-manager 2.0.9 to find the dependencies.
 
 I am wondering if this plugin failed purging my dependencies because
 it used a maven 2 library to scan the dependencies, and my local repo
 has only been built and used by mvn3 (and the repo metadata/layout
 could be different to what this plugin was expecting) ..
 Any thoughts ?
 thanks a lot in advance
 Anthony
 pom.xml
 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org

Thanks,

Jason

--
Jason van Zyl
Founder  CTO, Sonatype
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

To do two things at once is to do neither.
 
 -—Publilius Syrus, Roman slave, first century B.C.







Re: Recommendations to resolve artifact/version fubar

2012-06-03 Thread Rolf Lear

OK, that's a good point.

So, if I use jdom-legacy ('legacy' is a better description for my 
situation than 'deprecated')


then anyone needing just one or the other version of JDOM can use plain 
'jdom', but people needing both can use 'jdom' for version 2.x and and 
jdom-legacy for version 1.x


I cannot see anyone needing anything more complicated than this am I 
right?


In summary, people needing just one JDOM version:

   dependency
 groupIdorg.jdom/groupId
 artifactIdjdom/artifactId
 version2.0.1/version
 scopecompile/scope
   /dependency


people needing 1.x and 2.x versions (perhaps because they have a 3rd-party with 
a dependency on an old version)


   dependency
 groupIdorg.jdom/groupId
 artifactIdjdom/artifactId
 version2.0.1/version
 scopecompile/scope
   /dependency
   dependency
 groupIdorg.jdom/groupId
 artifactIdjdom-legacy/artifactId
 version1.1.3/version
 scopecompile/scope
   /dependency


Thanks

Rolf

On 03/06/2012 9:41 AM, Stephen Connolly wrote:

the convention for an artifact containing deprectated classes is to
give it the artifactId foo-deprecated or foo-legacy

Please strongly consider following that convention rather than going
with foo.dep

On 2 June 2012 01:29, Rolf Learj...@tuis.net  wrote:

Hi again everyone.

I have taken some time and installed a nexus locally, and I have been
playing with different alternatives for how to solve my problem

To recap, I have JDOM versions 1.x and 2.x both currently deployed in the
artifact 'jdom' even though these versions internally have different
packages (org.jdom.* and org.jdom2.* ). The problem is that it is necessary
in some conditions to have both version 1.x and 2.x in a maven project
(typically because the 1.x version is used by some third-party dependency).

I have been trying to find the 'best' way to 'recover' the mess in the JDOM
artifact so that it is possible to have both 1.x as well as 2.x, but to do
it in such a way that it has the least impact on current users, and for
those users who *need* both versions, it can be done as simply as possible.

In my experimentation I think I have found that the *easiest* and also the
*neatest* solution is to duplicate the latest JDOM 1.x artifact with a
different artifact-id. In my local nexus I have duplicated the JDOM 1.1.3
artifact as jdom.dep 1.1.3.

The way I see this working is that for the 'simple' user, they do not have
the complicated requirement to have both 1.x and 2.x. In their case they can
just continue doing what they do and when they are ready they can
upgrade their code to use JDOM 2.x, changing their dependency from jdom 1.x
to jdom 2.x when they do.

For the complicated user, they will be needing both versions. Right now they
can't run their code because they can't have both 1.x and 2.x in their
compile. In the typical case there is a third-party dependency which in turn
depends on jdom 1.x. Since 'our' project depends on jdom 2.x and the 3rd
party depends on 1.x, maven will automatically just pull the 'newer' jdom
2.x version. This means that the 3rd-party code will be failing because it
is missing classes.

In this case, we can simply add the 'jdom.dep' artifact to our project,
specifying the 1.x version.

I have 'worked through' the various scenarios, and I think it can be
expressed as follows:

Say I have my project. It has the simple dependency:


dependency
  groupIdorg.jdom/groupId
  artifactIdjdom/artifactId
  version2.0.1/version
  scopecompile/scope
/dependency

Now I want to include the additional dependency (this is just some
'arbitrary' dependency which has an internal dependency to jdom 1.1):

dependency
  groupIdnet.sourceforge.htmlcleaner/groupId
  artifactIdhtmlcleaner/artifactId
  version2.2/version
/dependency

Unfortunately this htmlcleaner code will not work because I am missing the
org.jdom.* classes because maven has only used the jdom 2.0.1 version which
only has the org.jdom2.* classes.

The solution is, in my project, to also include the 'duplicate' 1.x
dependency:

dependency
  groupIdorg.jdom/groupId
  artifactIdjdom.dep/artifactId
  version1.1.3/version
/dependency


The bottom line is that only those people who require both versions will be
affected, and the solution only requires adding a new dependency to the
project, and there is no need to do 'exclusions' or other 'shady' logic

Further, there is no need for the 'normal' JDOM user (they only require the
one version of JDOM) to worry about anything because things just stay the
same there is nothing to change.

I would greatly appreciate it if this 'plan' could be inspected and
criticized/poked/verified/etc.

Thanks in advance

Rolf




On 29/05/2012 11:38 AM, Rolf Lear wrote:


On Tue, 29 May 2012 16:22:27 +0100, Stephen Connolly
stephen.alan.conno...@gmail.comwrote:

On 29 May 2012 15:26, Rolf Learj...@tuis.netwrote:



So, being 

Trouble downloading repositories

2012-06-03 Thread Luis Eric López Fernández
Hello,

I am just learning maven and I am having trouble with some repositories.

I attach my POM and here is the error message I am getting:

---

[INFO] Compiling 2 source files to C:\Users\x0161479\Desktop\Eric's
Docs\Training\JEE 6\05292012\target\classes
[INFO] -
[ERROR] COMPILATION ERROR :
[INFO] -
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[3,0] package javax.persistence does not
exist
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[5,1] cannot find symbol
symbol: class Entity
@Entity
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[6,1] cannot find symbol
symbol: class NamedQuery
@NamedQuery(name = findAllBooks, query = SELECT b FROM Book b)
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Main.java:[3,0] package javax.persistence does not
exist
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[9,5] cannot find symbol
symbol  : class Id
location: class com.apress.javaee6.chapter02.Book
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[9,9] cannot find symbol
symbol  : class GeneratedValue
location: class com.apress.javaee6.chapter02.Book
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[11,5] cannot find symbol
symbol  : class Column
location: class com.apress.javaee6.chapter02.Book
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[14,5] cannot find symbol
symbol  : class Column
location: class com.apress.javaee6.chapter02.Book
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Main.java:[19,2] cannot find symbol
symbol  : class EntityManagerFactory
location: class com.apress.javaee6.chapter02.Main
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Main.java:[20,5] cannot find symbol
symbol  : variable Persistence
location: class com.apress.javaee6.chapter02.Main
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Main.java:[21,2] cannot find symbol
symbol  : class EntityManager
location: class com.apress.javaee6.chapter02.Main
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Main.java:[24,2] cannot find symbol
symbol  : class EntityTransaction
location: class com.apress.javaee6.chapter02.Main
[INFO] 12 errors
[INFO] -
[INFO]

[INFO] BUILD FAILURE
[INFO]

[INFO] Total time: 40.096s
[INFO] Finished at: Fri Jun 01 16:41:17 CDT 2012
[INFO] Final Memory: 6M/15M
[INFO]

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
(default-compile) on project chapter02: Compilation failure: Compilation
failure:
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[3,0] package javax.persistence does not
exist
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[5,1] cannot find symbol
[ERROR] symbol: class Entity
[ERROR] @Entity
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[6,1] cannot find symbol
[ERROR] symbol: class NamedQuery
[ERROR] @NamedQuery(name = findAllBooks, query = SELECT b FROM Book b)
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Main.java:[3,0] package javax.persistence does not
exist
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[9,5] cannot find symbol
[ERROR] symbol  : class Id
[ERROR] location: class com.apress.javaee6.chapter02.Book
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[9,9] cannot find symbol
[ERROR] symbol  : class GeneratedValue
[ERROR] location: class com.apress.javaee6.chapter02.Book
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[11,5] cannot find symbol
[ERROR] symbol  : class Column
[ERROR] location: class com.apress.javaee6.chapter02.Book
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE
6\05292012\src\main\java\Book.java:[14,5] cannot find symbol
[ERROR] symbol  : class Column
[ERROR] location: class com.apress.javaee6.chapter02.Book
[ERROR] \Users\x0161479\Desktop\Eric's Docs\Training\JEE

Re: How to overwrite property values defined in parent POM?

2012-06-03 Thread hujirong
Yes, it worked.

But I still there is one more I can find out, don't know where does it come
from, I searched all its parent POM. How can I list all runtime properties?

Thanks
Jirong

[ERROR] Failed to execute goal on project CDIPubSubMgmtBOLib: Could not
resolve dependencies for project
com.nbfg.mdm.wesb:CDIPubSubMgmtBOLib:jar:0.0.1-SNAPSHOT: Could not find
artifact com.ibm.websphere.runtimes:admin.core:jar:7.0.0 at specified path
*C:/IBM/SDP*/runtimes/base_v7/plugins/com.ibm.ws.admin.core.jar - [Help 1]

--
View this message in context: 
http://maven.40175.n5.nabble.com/How-to-overwrite-property-values-defined-in-parent-POM-tp5710554p5710743.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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