Mirror-any setup doesn't work with snapshots

2009-02-20 Thread Olivier THIERRY
Hi,

I try to user mirror-any setup with Maven 2.0.10 and Artifactory 2.0.2
but it doesn't work with snapshots. Any time I have a dependency to a
snapshot artifact in a POM file, it fails at resolving it.

For example :

[ERROR] BUILD ERROR
[INFO] 
[INFO] Failed to resolve artifact.

GroupId: org.andromda.maven.plugins
ArtifactId: andromdapp-maven-plugin
Version: 3.4-SNAPSHOT

Reason: Unable to download the artifact from any repository

  org.andromda.maven.plugins:andromdapp-maven-plugin:pom:3.4-SNAPSHOT

from the specified remote repositories:
  artifactory (http://intrabe:8080/artifactory/repo)

But I can see this artifact using Artifactory web client, so it exists !

I configured mirror-any this way in Maven settings.xml file :

mirror
  idartifactory/id
  mirrorOf*/mirrorOf
  nameHoroquartz Repository/name
  urlhttp://intrabe:8080/artifactory/repo/url
/mirror

I see nothing in Artifactory logs, so it looks like no request is sent
to Artifactory.

Anyone has an idea what I did wrong ?

Regards,

Olivier

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



Re: Mirror-any setup doesn't work with snapshots

2009-02-20 Thread Olivier THIERRY
2009/2/20 Yoav Landman yland...@gmail.com:
 Hi,

 Did you experience a different behavior with 2.0.9?
 Can you try explicitly overriding central and snapshots (classic setup -
 http://wiki.jfrog.org/confluence/display/RTF/Configuring+Artifacts+Resolution
 ).

 Yoav

 On Fri, Feb 20, 2009 at 11:05 AM, Olivier THIERRY olivier.thie...@gmail.com
 wrote:

 Hi,

 I try to user mirror-any setup with Maven 2.0.10 and Artifactory 2.0.2
 but it doesn't work with snapshots. Any time I have a dependency to a
 snapshot artifact in a POM file, it fails at resolving it.

 For example :

 [ERROR] BUILD ERROR
 [INFO]
 
 [INFO] Failed to resolve artifact.

 GroupId: org.andromda.maven.plugins
 ArtifactId: andromdapp-maven-plugin
 Version: 3.4-SNAPSHOT

 Reason: Unable to download the artifact from any repository

  org.andromda.maven.plugins:andromdapp-maven-plugin:pom:3.4-SNAPSHOT

 from the specified remote repositories:
  artifactory (http://intrabe:8080/artifactory/repo)

 But I can see this artifact using Artifactory web client, so it exists !

 I configured mirror-any this way in Maven settings.xml file :

mirror
  idartifactory/id
  mirrorOf*/mirrorOf
  nameHoroquartz Repository/name
  urlhttp://intrabe:8080/artifactory/repo/url
/mirror

 I see nothing in Artifactory logs, so it looks like no request is sent
 to Artifactory.

 Anyone has an idea what I did wrong ?

 Regards,

 Olivier

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




Thanks for your response Yoav !

First, no different behaviour for Maven 2.0.9 or 2.0.10, same problem.

I have explicitely overriden snapshots and central repositories in my
pom.xml as you suggested and it works.
Actually that's the way I used to do it before upgrading to 2.0.10.
But I tried mirror-any feature to avoid this explicit overriding,
because I don't think it's a very good point to configure the same
entreprise repository url in both settings.xml and pom.xml. When I
discovered mirror-any feature I loved the idea that you setup a mirror
to artifactory once, and it will be used for all your Maven projects.
But maybe I misunderstood why mirror-any feature has been added ?

Regards,

Olivier

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



How to get files from JAR dependencies in a plugin ?

2009-02-09 Thread Olivier THIERRY
Hi,

For a Maven project using Sun JAX-WS, I try to write a Maven plugin
(my first one) that should create Sun JAX-WS config file by merging
XML files from JAR dependencies.

It would be configured this way :

   plugin
   groupIdfr.xxx.t4/groupId
   artifactIdmaven-sun-jaxws-plugin/artifactId
   executions
   execution
   goals
   goalmerge/goal
   /goals
   /execution
   /executions
   configuration

targetFilesrc/main/webapp/WEB-INF/sun-jaxws.xml/targetFile
   sourceFiles

paramMETA-INF/sun-jaxws-commons.xml/param

paramMETA-INF/sun-jaxws-gt.xml/param
   /sourceFiles
   /configuration
   /plugin

This plugin should create a file referred by targetFile property by
reading and merging files referred by sourceFiles property. Source
files are in Maven project dependencies.
So I need to get an input stream on these source files, but I can't
find a way to find these files. I tried with getResourceAsStream but
it doesn't work.
Anyone has an idea how I could do this ?

Regards,

Olivier

PS : I already posted this question on dev list but I am not sure this
was the right place to get an answer for this ...

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



Re: Maven tries to download snapshots in offline mode

2008-10-02 Thread Olivier THIERRY
Hi,

I tried with Maven 2.0.6 and it doesn't work neither. Not it looks like the
problem has not been solved. Or maybe there's a use case for which it has
not been solved.
I just tried again with Maven 2.0.9 and I have exactly the same problem. Not
the same error than yesterday, I can't understand why !
I checked again that the artifacts are in my local repository : they are.

Here is the log :

---

GroupId: org.andromda.maven.plugins
ArtifactId: andromda-maven-plugins
Version: 3.4-SNAPSHOT

Reason: System is offline.
  org.andromda.maven.plugins:andromda-maven-plugins:pom:3.4-SNAPSHOT

NOTE: Maven is executing in offline mode. Any artifacts not already in your
local
repository will be inaccessible.

---

We use Artifactory as a company repository.

We added the following mirrors in settings.xml  :

---
mirror
idandromda/id
mirrorOfandromda/mirrorOf
nameAndroMDA Repository/name
urlhttp://10.11.4.108:8080/artifactory/repo/url
/mirror

mirror
idapache-incubator/id
mirrorOfapache-incubator/mirrorOf
nameApache Incubator Repository/name
urlhttp://10.11.4.108:8080/artifactory/repo/url
/mirror

mirror
idjboss/id
mirrorOfjboss/mirrorOf
nameJBoss Repository/name
urlhttp://10.11.4.108:8080/artifactory/repo/url
/mirror

mirror
idcentral/id
mirrorOfcentral/mirrorOf
nameJBoss Repository/name
urlhttp://10.11.4.108:8080/artifactory/repo/url
/mirror

mirror
idapache-m2-snapshot/id
mirrorOfapache-m2-snapshot/mirrorOf
nameJBoss Repository/name
urlhttp://10.11.4.108:8080/artifactory/repo/url
/mirror

---

And we have a parent pom for all our projects with this configuration for
repositories :

---
repositories
  repository
idandromda/id
urlhttp://10.11.4.108:8080/artifactory/repo/url
snapshots
enabledtrue/enabled
updatePolicydaily/updatePolicy
/snapshots
  /repository
  repository
idapache-m2-snapshot/id
urlhttp://10.11.4.108:8080/artifactory/repo/url
snapshots
enabledfalse/enabled
/snapshots
  /repository
  repository
idcentral/id
urlhttp://10.11.4.108:8080/artifactory/repo/url
snapshots
  enabledfalse/enabled
/snapshots
  /repository
  repository
idsnapshots/id
urlhttp://10.11.4.108:8080/artifactory/repo/url
releases
  enabledtrue/enabled
  updatePolicydaily/updatePolicy
/releases
  /repository
/repositories

pluginRepositories
pluginRepository
idandromda/id
urlhttp://10.11.4.108:8080/artifactory/repo/url
snapshots
enabledfalse/enabled
/snapshots
/pluginRepository
pluginRepository
idcentral/id
urlhttp://10.11.4.108:8080/artifactory/repo/url
snapshots
enabledfalse/enabled
/snapshots
/pluginRepository
pluginRepository
idsnapshots/id
urlhttp://10.11.4.108:8080/artifactory/repo/url
releases
enabledtrue/enabled
updatePolicydaily/updatePolicy
/releases
/pluginRepository
/pluginRepositories



Hope it will help understand where the problem comes from.

Cheers,

Olivier


2008/10/1 Olivier THIERRY [EMAIL PROTECTED]

 2008/10/1 Baptiste MATHUS [EMAIL PROTECTED]

 2008/10/1 Jorg Heymans [EMAIL PROTECTED]

  On Wed, Oct 1, 2008 at 10:47 AM, Baptiste MATHUS [EMAIL PROTECTED] wrote:
   Before doing so, might be better to receive the blessing here from a
  maven
   committer :).
 
  +1 for reopening, and looking at the ticket there is already enough user
  blessings to warrant it being reopened.
 

 Sure, but I also adviced to test the 2.0.6 before as it will help fixing
 it:
 the fix might be easier to do if we know this was working with 2.0.6 and
 not
 with 2.0.9, or if the fix simply never worked whatever the version.

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


 I can't do the tests now because of a daily updatePolicy for my snapshots.
 But I will try tomorrow.
 But I remember I had also this problem with Maven 2.0.4

 --
 Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et encore
 pour l'univers, je ne suis pas sûr … (Einstein)




-- 
Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et encore
pour l'univers, je ne suis pas sûr … (Einstein)


Maven tries to download snapshots in offline mode

2008-10-01 Thread Olivier THIERRY
Hi,

I encounter problems using snapshots and offline mode with Maven
2.0.9.Maven tries to download snapshots while it should not since I
run in offline
mode ! I checked the dependencies it tries to retrieve are already in mu
repository so I think this is really a bug with Maven. It looks like other
people have the same problem as there is a JIRA :
http://jira.codehaus.org/browse/MNG-2433 This JIRA has been closed, but it
was not solved, so I think it should be reopened !

What is strange is that I don't have the problem if I run mvn install on a
workstation with no network. But if I run mvn -o install, the problem
occurs ! It should be the opposite, doesn't it ?

Here is the logs I have when running mvn -o install. Hope it will help to
solve this very annoying bug :

[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Failed to resolve artifact.

Missing:
--
1) org.drools:drools-core:jar:4.0.4M-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
  mvn install:install-file -DgroupId=org.drools -DartifactId=drools-core
-Dversion=4.0.4M-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file
there:
  mvn deploy:deploy-file -DgroupId=org.drools -DartifactId=drools-core
-Dversion=4.0.4M-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url]
-DrepositoryId=[id]

  Path to dependency:
  1) t4:t4-core-utils-core:ejb:1.0-SNAPSHOT
  2) t4:t4-utils:jar:1.0-SNAPSHOT
  3) org.drools:drools-core:jar:4.0.4M-SNAPSHOT

--
1 required artifact is missing.

for artifact:
  t4:t4-core-utils-core:ejb:1.0-SNAPSHOT

from the specified remote repositories:
  apache-m2-snapshot (http://10.11.4.108:8080/artifactory/repo),
  central (http://10.11.4.108:8080/artifactory/repo),
  andromda (http://10.11.4.108:8080/artifactory/repo),
  snapshots (http://10.11.4.108:8080/artifactory/repo)


NOTE: Maven is executing in offline mode. Any artifacts not already in your
local
repository will be inaccessible.


[INFO]

[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Missing:
--
1) org.drools:drools-core:jar:4.0.4M-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
  mvn install:install-file -DgroupId=org.drools -DartifactId=drools-core
-Dversion=4.0.4M-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file
there:
  mvn deploy:deploy-file -DgroupId=org.drools -DartifactId=drools-core
-Dversion=4.0.4M-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url]
-DrepositoryId=[id]

  Path to dependency:
  1) t4:t4-core-utils-core:ejb:1.0-SNAPSHOT
  2) t4:t4-utils:jar:1.0-SNAPSHOT
  3) org.drools:drools-core:jar:4.0.4M-SNAPSHOT

--
1 required artifact is missing.

for artifact:
  t4:t4-core-utils-core:ejb:1.0-SNAPSHOT

from the specified remote repositories:
  apache-m2-snapshot (http://10.11.4.108:8080/artifactory/repo),
  central (http://10.11.4.108:8080/artifactory/repo),
  andromda (http://10.11.4.108:8080/artifactory/repo),
  snapshots (http://10.11.4.108:8080/artifactory/repo)

at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:575)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by:
org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException:
Missing:

Re: Maven tries to download snapshots in offline mode

2008-10-01 Thread Olivier THIERRY
2008/10/1 Baptiste MATHUS [EMAIL PROTECTED]

 2008/10/1 Jorg Heymans [EMAIL PROTECTED]

  On Wed, Oct 1, 2008 at 10:47 AM, Baptiste MATHUS [EMAIL PROTECTED] wrote:
   Before doing so, might be better to receive the blessing here from a
  maven
   committer :).
 
  +1 for reopening, and looking at the ticket there is already enough user
  blessings to warrant it being reopened.
 

 Sure, but I also adviced to test the 2.0.6 before as it will help fixing
 it:
 the fix might be easier to do if we know this was working with 2.0.6 and
 not
 with 2.0.9, or if the fix simply never worked whatever the version.

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


I can't do the tests now because of a daily updatePolicy for my snapshots.
But I will try tomorrow.
But I remember I had also this problem with Maven 2.0.4

-- 
Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et encore
pour l'univers, je ne suis pas sûr … (Einstein)


Re: How to merge pom files ?

2008-09-11 Thread Olivier THIERRY
I could not find a way to add individual files to shaded jar, I think this
is something not possible.
I workarounded the problem by packageing these individual files into a jar
file using a maven project. Then I included this jar as a dependency in my
t4-core-all project and in Shade plugin configuration and it works perfect.

Thanks for introducing me to Shade Plugin, it helped me a lot.

Regards,

Olivier

2008/9/9 John Prystash [EMAIL PROTECTED]

 My experience with shade plugin is quite limited, I've only included other
 dependencies that are external to my project, not individual files.
 You might be able to create an assembly that packages the shaded jar with
 the additional files as long as you do not need the files packaged in the
 jar.  That approach probably wouldn't help if you need the files on the
 classpath.



 - Original Message 
 From: Olivier THIERRY [EMAIL PROTECTED]
 To: Maven Users List users@maven.apache.org
 Sent: Monday, September 8, 2008 4:29:08 AM
 Subject: Re: How to merge pom files ?

 Thanks a lot John, this is exactly what I needed :)

 Based on the plugin configuration you suggested, I added
 promoteTransitiveDependencies property and set it to true so that
 transitive
 dependencies become direct dependencies in the shaded jar.

 But I have one problem yet : I need to add some files to the shaded jar. I
 saw you can exclude files from the shaded jar with filters property, but I
 can't see a way to add a new file to the shaded jar. I thought about
 creating a new artifact in M2 repository with these files to add and add
 this artifact to the artifactSet includes property. It should work but I
 wonder if there's an easier way to do it. Do you have any idea about this ?

 Regards,

 Olivier


 2008/9/5 John Prystash [EMAIL PROTECTED]

  You might want to take a look at the shade plugin
 
  http://maven.apache.org/plugins/maven-shade-plugin/
 
  A configuration like the following should create a jar containing the
  classes from the two t4 jars you depend on:
 
  plugin
 groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-shade-plugin/artifactId
  executions
   execution
 phasepackage/phase
 goals
goalshade/goal
 /goals
 configuration
   artifactSet
 includes
   includet4:t4-core-utils/include
   includet4:t4-common-utils/include
 /includes
   /artifactSet
 /configuration
   /execution
 /executions
   /plugin
 
 
 
  - Original Message 
  From: Olivier THIERRY [EMAIL PROTECTED]
  To: users@maven.apache.org
  Sent: Friday, September 5, 2008 10:52:00 AM
  Subject: How to merge pom files ?
 
  Hi all,
 
  I have two Maven projects named t4-core-utils and t4-core-commons. They
  build jar artifacts and install them to my M2 repository.
  Now I want to build a jar that merges both jars (extract files from these
  jars and add them to a new jar) then install it to M2 repository so that
 it
  can be used as a dependency in other Maven projects.
 
  I tried to use Maven Assembly plugin to achieve this. I could create the
  new
  jar and install it to M2 repo, but I have problems with the way pom file
 is
  generated in M2 repo.
 
  The pom.xml is as following (t4-parent is used for dependency management)
 :
 
  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;
   modelVersion4.0.0/modelVersion
   groupIdt4/groupId
   artifactIdt4-core-all/artifactId
   packagingjar/packaging
 parent
 groupIdt4/groupId
 artifactIdt4-parent/artifactId
 version1.0-SNAPSHOT/version
 /parent
   version1.0-SNAPSHOT/version
   nameT4 Core All/name
  dependencies
   dependency
   groupIdt4/groupId
   artifactIdt4-core-utils/artifactId
   version${version}/version
   /dependency
   dependency
   groupIdfr.horoquartz.t4/groupId
   artifactIdt4-core-commons/artifactId
   version${version}/version
   /dependency
   /dependencies
 build
   plugins
   plugin
   artifactIdmaven-assembly-plugin/artifactId
   configuration
 descriptors
 
  descriptorsrc/main/assembly/t4-core-all.xml/descriptor
   /descriptors
   appendAssemblyIdfalse/appendAssemblyId
   /configuration
 executions
 execution
 phasepackage/phase
 goals
 goalattached/goal
 /goals
 /execution

How to set system property for a plugin ?

2008-09-11 Thread Olivier THIERRY
Hi,

I try to use Hibernate3 Maven plugin to generate DDL from JPA entities
bundled in a JAR. This JAR has a persistence.xml with no Hibernate dialect
set (it's because I want it to be database independant). Actually I use -D
option to set this dialect.
For example : mvn install
-Dhibernate.dialect=org.hibernate.dialect.HSQLDialect

Now I would like to set this system property in pom.xml. I tried with
systemProperties tag within plugin configuration (see below) but is
doesn't work. Anyone has an idea how I should do this ?

My pom.xml :

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;
  modelVersion4.0.0/modelVersion
  groupIdt4/groupId
  artifactIdt4-core-ddl/artifactId
  packagingpom/packaging
parent
groupIdt4/groupId
artifactIdt4-parent/artifactId
version1.0-SNAPSHOT/version
/parent
  version1.0-SNAPSHOT/version
  nameT4 Core DDL/name
   dependencies
   dependency
groupIdt4/groupId
artifactIdt4-core-all/artifactId
version${version}/version
/dependency
   dependency
   groupIdorg.hibernate/groupId
   artifactIdhibernate-annotations/artifactId
   /dependency
   dependency
   groupIdorg.hibernate/groupId
   artifactIdhibernate-entitymanager/artifactId
   /dependency
   /dependencies
build
  plugins
plugin
groupIdorg.codehaus.mojo/groupId
   artifactIdhibernate3-maven-plugin/artifactId
   configuration
componentProperties
dropfalse/drop
exportfalse/export
outputfilenamet4-core.sql/outputfilename
   /componentProperties
   components
   component
   namehbm2ddl/name

implementationjpaconfiguration/implementation
/component
/components
systemProperties
 property
namehibernate.dialect/name
valueorg.hibernate.dialect.HSQLDialect/value
/property
/systemProperties
/configuration
executions
execution
phasetest-compile/phase
goals
goalhbm2ddl/goal
/goals
/execution
/executions
/plugin
/plugins
  /build
/project

Thanks in advance,

Olivier


Re: surefire-reports for the individual test results????

2008-09-09 Thread Olivier THIERRY
You should have a text file in
J:\IDE\workspace\test_WS\maven-copydependencies-plugin\target\surefire-reports.
It will tell you what kind of failure you had during tests.

2008/9/9 simoha [EMAIL PROTECTED]


 Hi all,
  I created my First maven-plugin and successfully compiled it.
 when I try to install it with mvn install , I get the following error
 message...

 Error:
 ...
 [INFO]
 
 [ERROR] BUILD FAILURE
 [INFO]
 
 [INFO] There are test failures.

 Please refer to

 J:\IDE\workspace\test_WS\maven-copydependencies-plugin\target\surefire-reports
 for the individual test results.
 [INFO]
 
 [INFO] For more information, run Maven with the -e switch
 [INFO]
 
 [INFO] Total time: 29 seconds
 [INFO] Finished at: Tue Sep 09 10:27:23 CEST 2008
 [INFO] Final Memory: 26M/254M
 [INFO]
 

 It would be nice if someone could help me to resolve this problem
 Thanks im Advance

 --
 View this message in context:
 http://www.nabble.com/surefire-reports-for-the-individual-test-results-tp19388584p19388584.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]




-- 
Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et encore
pour l'univers, je ne suis pas sûr … (Einstein)


Re: How to merge pom files ?

2008-09-08 Thread Olivier THIERRY
Thanks a lot John, this is exactly what I needed :)

Based on the plugin configuration you suggested, I added
promoteTransitiveDependencies property and set it to true so that transitive
dependencies become direct dependencies in the shaded jar.

But I have one problem yet : I need to add some files to the shaded jar. I
saw you can exclude files from the shaded jar with filters property, but I
can't see a way to add a new file to the shaded jar. I thought about
creating a new artifact in M2 repository with these files to add and add
this artifact to the artifactSet includes property. It should work but I
wonder if there's an easier way to do it. Do you have any idea about this ?

Regards,

Olivier


2008/9/5 John Prystash [EMAIL PROTECTED]

 You might want to take a look at the shade plugin

 http://maven.apache.org/plugins/maven-shade-plugin/

 A configuration like the following should create a jar containing the
 classes from the two t4 jars you depend on:

 plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-shade-plugin/artifactId
 executions
  execution
phasepackage/phase
goals
   goalshade/goal
/goals
configuration
  artifactSet
includes
  includet4:t4-core-utils/include
  includet4:t4-common-utils/include
/includes
  /artifactSet
/configuration
  /execution
/executions
  /plugin



 - Original Message 
 From: Olivier THIERRY [EMAIL PROTECTED]
 To: users@maven.apache.org
 Sent: Friday, September 5, 2008 10:52:00 AM
 Subject: How to merge pom files ?

 Hi all,

 I have two Maven projects named t4-core-utils and t4-core-commons. They
 build jar artifacts and install them to my M2 repository.
 Now I want to build a jar that merges both jars (extract files from these
 jars and add them to a new jar) then install it to M2 repository so that it
 can be used as a dependency in other Maven projects.

 I tried to use Maven Assembly plugin to achieve this. I could create the
 new
 jar and install it to M2 repo, but I have problems with the way pom file is
 generated in M2 repo.

 The pom.xml is as following (t4-parent is used for dependency management) :

 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;
  modelVersion4.0.0/modelVersion
  groupIdt4/groupId
  artifactIdt4-core-all/artifactId
  packagingjar/packaging
parent
groupIdt4/groupId
artifactIdt4-parent/artifactId
version1.0-SNAPSHOT/version
/parent
  version1.0-SNAPSHOT/version
  nameT4 Core All/name
 dependencies
  dependency
  groupIdt4/groupId
  artifactIdt4-core-utils/artifactId
  version${version}/version
  /dependency
  dependency
  groupIdfr.horoquartz.t4/groupId
  artifactIdt4-core-commons/artifactId
  version${version}/version
  /dependency
  /dependencies
build
  plugins
  plugin
  artifactIdmaven-assembly-plugin/artifactId
  configuration
descriptors

 descriptorsrc/main/assembly/t4-core-all.xml/descriptor
  /descriptors
  appendAssemblyIdfalse/appendAssemblyId
  /configuration
executions
execution
phasepackage/phase
goals
goalattached/goal
/goals
/execution
/executions
  /plugin
  /plugins
  /build
 /project

 And the t4-core-all.xml file :

 ?xml version=1.0 encoding=UTF-8?
 assembly 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../../../../exchange-ws-api/assembly-1.1.0-SNAPSHOT.xsd
 
idt4-core-all/id
  formats
formatjar/format
  /formats
  includeBaseDirectoryfalse/includeBaseDirectory
  dependencySets
   dependencySet
   unpacktrue/unpack
   unpackOptions
   excludes
   excludeMETA-INF/persistence.xml/exclude
   excludeMETA-INF/ejb-jar.xml/exclude
   /excludes
  /unpackOptions
   useTransitiveDependenciesfalse/useTransitiveDependencies
/dependencySet
  /dependencySets
files
file
sourcesrc/main/assembly/persistence.xml/source
outputDirectoryMETA-INF/outputDirectory
/file
file
sourcesrc/main/assembly/ejb-jar.xml/source

Re: Creating a jar/zip with dependencies

2008-09-08 Thread Olivier THIERRY
I had the same kind of need.
You should try Maven Assembly Plugin :
http://maven.apache.org/plugins/maven-assembly-plugin/
Or maybe Maven Shade Plugin :
http://maven.apache.org/plugins/maven-shade-plugin/

2008/9/8 Karl Heinz Marbaise [EMAIL PROTECTED]

 Hi there,

 i have a project which has the following structure:

 parent
  +--- Module A (depends on C and D)
  +--- Module B
  +--- Module C
  +--- Module D


 Module A has of course other dependencies too

 Now coming to my problem:

 I would like to create a zip/jar which comprises of the Module A-jar
 and of it's dependencies (Module C and D) and of course of their
 external dependencies (e.g. Log4j.jar, spring-2.5.4.jar,
 commons-collections, xstream etc.)
 Those dependencies have been defined in Module A, C and D.

 If i do a mvn package in module A i only get a jar file which comprises
 of the Classes in Module A without any dependencies

 I would like to create that zip/jar as a result of the package (for
 delivery)

 Does someone has an idea or a hint about that ?


 Kind regards
 Karl Heinz Marbaise
 --
 SoftwareEntwicklung Beratung SchulungTel.: +49 (0) 2405 / 415 893
 Dipl.Ing.(FH) Karl Heinz MarbaiseICQ#: 135949029
 Hauptstrasse 177 USt.IdNr: DE191347579
 52146 Würselen   http://www.soebes.de

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et encore
pour l'univers, je ne suis pas sûr … (Einstein)


Re: How to stop Maven to look for updates on snapshots?

2008-09-07 Thread Olivier THIERRY
It looks like this issue : http://jira.codehaus.org/browse/MNG-2433
It is supposed to have been corrected with Maven 2.0.6, but I still have the
problem with Maven 2.0.8 and it happened to me when doing a demonstration
with no internet connection, not funny at all.
This issue has to be reopened !

2008/9/5 Francis Yuen [EMAIL PROTECTED]

 Hi,
 I have a project A that depends on an artifact X which is a SNAPSHOT.
 Artifact X uses a parent pom X1 which uses a parent pom X2.  Both X1 and X2
 are SNAPSHOTs.  Artifact X, X1 and X2 are available from a remote
 repository
 R.

 In the pom of project A, I included repository R by defining its id, name
 and url.  Artifacts X, X1 and X2 were brought in to my local repository by
 running mvn install on the project pom.  I want to be able to stop Maven
 from getting updates on artifact X.  On a new day, if I run mvn install in
 offline mode, the build fails.  After I build the project in online mode,
 subsequent builds on the same day can be run in offline mode.  I did a
 couple of tests:

 Test 1.
 I advanced the date to a day later than today and then ran mvn -o -e
 install.  The build failed and the error was that X was missing.  The
 error
 messages suggested to download X manually from the project site and then
 install it using mvn install:install.

 Test 2.
 In the pom of project A, I added
 snapshotsupdatePolicynever/updatePolicy/snapshots to respository
 section of R.  I advanced the date to a day later and then ran mvn -o -e
 install.  The build failed.  The message thrown by
 org.apache.maven.artifact.resolver.ArtifactResolutionException indicated
 that it was unable to read the metadata file for artifact X: Cannot find
 parent X2 for X1 for X.

 It looks like that in Test 1, Maven did not see X to be in my local
 repository.  In Test 2, by introducing repository snapshot never update
 policy in the project pom, Maven seems to see X and X1 but not X2.

 I am fairly new to Maven.  Can someone tell me how to stop Maven to look
 for
 updates on snapshots (or its parent pom)?



How to merge pom files ?

2008-09-05 Thread Olivier THIERRY
Hi all,

I have two Maven projects named t4-core-utils and t4-core-commons. They
build jar artifacts and install them to my M2 repository.
Now I want to build a jar that merges both jars (extract files from these
jars and add them to a new jar) then install it to M2 repository so that it
can be used as a dependency in other Maven projects.

I tried to use Maven Assembly plugin to achieve this. I could create the new
jar and install it to M2 repo, but I have problems with the way pom file is
generated in M2 repo.

The pom.xml is as following (t4-parent is used for dependency management) :

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;
  modelVersion4.0.0/modelVersion
  groupIdt4/groupId
  artifactIdt4-core-all/artifactId
  packagingjar/packaging
parent
groupIdt4/groupId
artifactIdt4-parent/artifactId
version1.0-SNAPSHOT/version
/parent
  version1.0-SNAPSHOT/version
  nameT4 Core All/name
 dependencies
  dependency
  groupIdt4/groupId
  artifactIdt4-core-utils/artifactId
  version${version}/version
  /dependency
  dependency
  groupIdfr.horoquartz.t4/groupId
  artifactIdt4-core-commons/artifactId
  version${version}/version
  /dependency
  /dependencies
build
  plugins
  plugin
  artifactIdmaven-assembly-plugin/artifactId
  configuration
descriptors

descriptorsrc/main/assembly/t4-core-all.xml/descriptor
  /descriptors
  appendAssemblyIdfalse/appendAssemblyId
  /configuration
executions
execution
phasepackage/phase
goals
goalattached/goal
/goals
/execution
/executions
  /plugin
  /plugins
  /build
/project

And the t4-core-all.xml file :

?xml version=1.0 encoding=UTF-8?
assembly 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../../../../exchange-ws-api/assembly-1.1.0-SNAPSHOT.xsd

idt4-core-all/id
  formats
formatjar/format
  /formats
  includeBaseDirectoryfalse/includeBaseDirectory
  dependencySets
   dependencySet
   unpacktrue/unpack
   unpackOptions
   excludes
   excludeMETA-INF/persistence.xml/exclude
   excludeMETA-INF/ejb-jar.xml/exclude
   /excludes
  /unpackOptions
   useTransitiveDependenciesfalse/useTransitiveDependencies
/dependencySet
  /dependencySets
files
file
sourcesrc/main/assembly/persistence.xml/source
outputDirectoryMETA-INF/outputDirectory
/file
file
sourcesrc/main/assembly/ejb-jar.xml/source
outputDirectoryMETA-INF/outputDirectory
/file
/files
/assembly

The pom generated for t4-core-all just contains dependencies to
t4-core-utils and t4-core-commons. So when adding t4-core-all as a
dependency, I have all classes twice, in t4-core-all and in t4-core-commons
or t4-core-utils ... Actually what I need is that the pom for t4-core-all
contains transitive dependencies from t4-core-utils and t4-core-commons (for
example hibernate, commons-lang, etc...), and not dependencies to
t4-core-utils and t4-core-commons. A kind of pom merging. Is there a way to
do this ?

Thanks in advance,

Olivier