mvn deploy and actual version capture
For historical reasons, we are using cruisecontrol rather than continuum for our maven2 builds. We are also using a cruise control project that invokes a shell script to invoke maven because there appears to be a bug in maven now that I've been unable to get any responses to when I posted its details on the user and developer mailing lists. When the shell script invokes "mvn deploy" in order to deploy the SNAPSHOT artifact to the repository and give it a "real" version timestamp rather than the X-X-snapshot version, we need to be able to "know" (capture, find out) what the actual version (or actual filename) is, so that we can place a copy of the artifact on a web server for external consumption. How can we figure out the filename that was deployed in a "mvn deploy" invocation? * Eric PS: The bug I'm referring to forces me to break up my multi-project build into separate "mvn" invocations in various sub-directories. If I try to invoke "mvn install" or "mvn deploy" from the top-level pom, I get some obscure error in the bowels of default-plexus-container where it gets an error in some java.lang.reflect api trying to access the jarArchive mojo field of the maven-jar-plugin. I've had no luck getting any help on this one.
RE: Inherited property resolution
I've recently run into the same situation. I think the reason why you are not able to resolve the property value is that in order to do so, the parent POM must be located (because that is where the property is defined). You can't refer to that property in the element. If you simply changed the element to use an explicit version number, the parent pom would be located and loaded, the variable resolved, and you could then use it in other parts of your child pom (including defining the version number of your child artifact). I'm doing this now. Now, you may be thinking the same thing I was thinking -- that this means you cannot define the parent version number in ONE place (the parent pom) and refer it via a property in all places in child poms. This appears to be the case and I consider it a limitation of Maven. It would appear that if you update the parent pom version number, you are forced to edit all the child poms to use that version number explicitly -- it can't be simply in one place. -- Eric -Original Message- From: Morgovsky, Alexander (US - Glen Mills) [mailto:[EMAIL PROTECTED] Sent: Saturday, October 28, 2006 8:12 AM To: users@maven.apache.org Subject: Inherited property resolution I have a parent project which defines a test_version property, and a child project which attempts to this property, which is the version of the application in this case. However, when doing a build, the test_version property of the parent element does not get resolved. I get this error. May someone please help me with this scenario? Thanks in advance for your help. [INFO] [ERROR] FATAL ERROR [INFO] [INFO] Failed to resolve artifact. GroupId: test ArtifactId: test Version: ${test_version} Reason: Unable to download the artifact from any repository test:test:pom:${test_version} [INFO] [INFO] Trace org.apache.maven.reactor.MavenExecutionException: Cannot find parent: test:test for projec t: test_sub_a:test_sub_a:pom:${test_version} Parent project test: test test 1.0.0 4.0.0 test_sub_a pom 1.0.0 Child project test_sub_a: test_sub_a test_sub_a ${test_version} 4.0.0 test test ${test_version} pom This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message. Any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. [v.E.1] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: maven-assembly-plugin woes
Well, my guess is that I'm having problems selecting artifacts to be included, but I think I did try using moduleSets and explicitly specifying some artifacts, and still, I didn't get any output in my repository artifact. Do you have any examples of assembly plugin use that work and generate a repository artifact in repository format (archived or not)? -- Eric -Original Message- From: Edwin Punzalan [mailto:[EMAIL PROTECTED] Sent: Friday, October 27, 2006 4:38 PM To: Maven Users List Subject: Re: maven-assembly-plugin woes Last I checked, the repository works. Did you have a problem with it ? Swenson, Eric wrote: > I have a large project that has some jar dependencies that are not in > any of the public repositories. Licenses prevent their being put there. > Rather than have my maven2 projects explicitly refer to these jar files > in the file system, I'd like to create a file-based repository to > include in my source distribution that is pre-populated with these > third-party jar files. I'd then have the project's pom refer to this > file-based repository, such that any dependencies would be looked up in > this file-based repository. I think this is better than having to ship > a shell script that invokes "mvn install:install-file" on each of the > jar files to populate the user's local repository with these third-party > dependencies. > > > > It would appear from the documentation of maven-assembly-plugin that > this plugin should be able to do the trick. But I haven't yet figured > out how to do what I want. I'd like to have a project that will > populate this file-based repository using a list of the project's > dependencies. When the project is "assembled", it would use the > mavan-assembly-plugin to store in a file-based repository all the > artifacts that are listed in the project's dependencies (not transitive, > only direct). > > > > For example, the project's pom would look (something) like: > > > > xmlns="http://maven.apache.org/POM/4.0.0"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > > 4.0.0 > > com.sony.cdt > > bootstrap-repository > > pom > > 1.0-SNAPSHOT > > Bootstrap Repository > >the bootstrap repository. --> > > > > > > org.acme > > foo > > 1.0 > > > > > > > > > > > > maven-assembly-plugin > > 2.0-beta-1 > > > > src/main/assembly/assembly.xml > > target/output > > target/assembly/work > > > > > > > > > > > > > > The assembly descriptor would look something like this: > > > > > > repository > > > > jar > > > > > > > > true > > maven2 > > > > > > > > > > > > Now what I want to be able to have is some element (moduleSets, > dependencySets, fileSets) that says: include all this pom's > dependencies. I don't want to list them explicitly. I want the list to > be populated using the in the pom. Is this possible? > > > > Of course, I could do away with the dependencies list in the pom and > just use: > > > > > > > > > > org.acme:foo:1.0 > > > > > > > > And I've tried that - but my "output repository jar" is always empty > (except for the manifest). > > > > Here is an actual assembly descriptor that I've used, and the output jar > is always empty: > > > > > > repository > > > > jar > > > > > > > > true > > maven2 > > > > > > > > > > > > org.acme:foo:1.0 > > > > > > > > > > > > > > org.acme:foo:1.0 > > > > > > > > > > > > Can anyone tell me what I'm doing wrong? Does the > feature (in the assembly descriptor) actually work? -- Eric > > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: local repository relative to top-level pom
Hi Wayne, It is indeed possible to do this. I just wanted to avoid having to do anything but "unzip and run maven". In fact, the whole way maven deals with dependencies that are NOT in public repositories and must be installed into a local repository (install:install-file) to enable a maven build is pretty clunky. Within a single organization, of course, one can provide a settings.xml file in the maven distribution that points to a network-based repository that contains the "bootstrap" files, but as soon as you hope to distribute the source code outside of the local area network, there really isn't a good solution (that I've found). What I was hoping was that the "bootstrap" repository could be delivered with the source tree and a single relative path used at the top-level pom would define this repository. I may have no choice but to do what you suggest -- have each child module's pom redefine the repository using a relative path based on its own ${basedir}. It just seemed ugly to have to define the repository in each pom. Thanks for your suggestions. -- Eric -Original Message- From: Wayne Fay [mailto:[EMAIL PROTECTED] Sent: Friday, October 27, 2006 11:00 AM To: Maven Users List Subject: Re: local repository relative to top-level pom Is it not possible to tell your users to edit the pom.xml (or provide a profile.xml) such that the file:// reference is absolute rather than relative? This seems to be the simplest way to do it. Or provide a relative path in each pom perhaps, unsure if this would work ie child/pom.xml ${basedir}/../repository. Wayne On 10/27/06, Swenson, Eric <[EMAIL PROTECTED]> wrote: > I'd like to store some bootstrap artifacts (like third party jars) in > maven2 repository layout structure and deliver this repository with my > project's sources. I'd like the top-level project pom to define this > repository such that all lower-level projects will attempt to retrieve > resources from this repository. But I want to refer to the repository > with a relative path so that everything will work whether the project's > source tree is placed. So, for example, I'd like this kind of layout: > > > >pom.xml > >repository/ > >module1/ > >module2/ > > > > And I'd like module1 and module2 to find bootstrap artifacts in the > "repository" subdirectory of the top-level project. If I define, in the > parent project's pom, something like: > > > > > > > > bootstrap > > Bootstrap Repoitory > > file://localhost/${basedir}/repository > > > > > > > > Things won't work because ${basedir} is evaluated in the context of a > child module's pom, and will refer to the directory where that child > module's pom is located. How can I define the file: URL such that it > will be valid in all sub-modules? > > > > -- Eric > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
local repository relative to top-level pom
I'd like to store some bootstrap artifacts (like third party jars) in maven2 repository layout structure and deliver this repository with my project's sources. I'd like the top-level project pom to define this repository such that all lower-level projects will attempt to retrieve resources from this repository. But I want to refer to the repository with a relative path so that everything will work whether the project's source tree is placed. So, for example, I'd like this kind of layout: pom.xml repository/ module1/ module2/ And I'd like module1 and module2 to find bootstrap artifacts in the "repository" subdirectory of the top-level project. If I define, in the parent project's pom, something like: bootstrap Bootstrap Repoitory file://localhost/${basedir}/repository Things won't work because ${basedir} is evaluated in the context of a child module's pom, and will refer to the directory where that child module's pom is located. How can I define the file: URL such that it will be valid in all sub-modules? -- Eric
maven-assembly-plugin woes
I have a large project that has some jar dependencies that are not in any of the public repositories. Licenses prevent their being put there. Rather than have my maven2 projects explicitly refer to these jar files in the file system, I'd like to create a file-based repository to include in my source distribution that is pre-populated with these third-party jar files. I'd then have the project's pom refer to this file-based repository, such that any dependencies would be looked up in this file-based repository. I think this is better than having to ship a shell script that invokes "mvn install:install-file" on each of the jar files to populate the user's local repository with these third-party dependencies. It would appear from the documentation of maven-assembly-plugin that this plugin should be able to do the trick. But I haven't yet figured out how to do what I want. I'd like to have a project that will populate this file-based repository using a list of the project's dependencies. When the project is "assembled", it would use the mavan-assembly-plugin to store in a file-based repository all the artifacts that are listed in the project's dependencies (not transitive, only direct). For example, the project's pom would look (something) like: xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 4.0.0 com.sony.cdt bootstrap-repository pom 1.0-SNAPSHOT Bootstrap Repository org.acme foo 1.0 maven-assembly-plugin 2.0-beta-1 src/main/assembly/assembly.xml target/output target/assembly/work The assembly descriptor would look something like this: repository jar true maven2 Now what I want to be able to have is some element (moduleSets, dependencySets, fileSets) that says: include all this pom's dependencies. I don't want to list them explicitly. I want the list to be populated using the in the pom. Is this possible? Of course, I could do away with the dependencies list in the pom and just use: org.acme:foo:1.0 And I've tried that - but my "output repository jar" is always empty (except for the manifest). Here is an actual assembly descriptor that I've used, and the output jar is always empty: repository jar true maven2 org.acme:foo:1.0 org.acme:foo:1.0 Can anyone tell me what I'm doing wrong? Does the feature (in the assembly descriptor) actually work? -- Eric
Internal error in plugin manager
Can anyone explain what this error means: [INFO] Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-jar-plugin:2.1:jar': Unable to find the mojo 'org.apache.maven.plugins:maven-jar-plugin:2.1:jar' in the plugin 'org.apache.maven.plugins:maven-jar-plugin' This only happens when I do a "mvn install" from a top-level POM that has a tree of subordinate child projects. If I cd to each of the subordinate directories, in turn, and manually, and run "mvn install" in each, they all succeed. Why is that when I try to do a reactor build I get this error message? What do I need to do to have it not do this? Currently, I have to have a shell script that walks the tree and runs "mvn install" in each of the subdirectories. Ugh. -- Eric
reactor issue?
I have a large project with a top-level pom building lower-level projects. When each of the lower-level projects had as their packaging target a "jar" file, everything worked as I would expect. I could do a "mvn install" in the top-level directory and maven would recurse into each sub-project () and do the appropriate thing. However, as I filled out my project, some of the sub-modules had other targets - war and wsr - and therefore not all projects had "jar" packaging. Now, when I do a "mvn install" from the top-level module, I get errors like this: [ERROR] BUILD ERROR [INFO] [INFO] Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-jar-plugin:2.1:jar': Unable to find the mojo 'org.apache.maven.plugins:maven-jar-plugin:2.1:jar' in the plugin 'org.apache.maven.plugins:maven-jar-plugin' This makes no sense to me, and I don't see what the non-jar projects (war and wsr) would have to do with this. In fact, I believe the sub-project that maven is trying to build at the time of this error is the first module - which *is* a jar package. Simply changing directories to this sub-project and doing a "mvn install" there works perfectly fine. In fact, I can go to each of the modules listed in the top-level pom and do a "mvn install" manually and they all work fine. Currently, that is my work-around. Any suggestions on why the above might be happening? (I'm using maven 2.0.4). -- Eric
maven-assembly-plugin troubles
I'm trying to assemble an image consisting of the artifacts created by a maven2 project. The artifacts (all installed and in the repository) are of three forms: - jar files - wsr files - war files I'm trying to author a pom and assembly descriptor file that will allow me to state the dependencies in the pom file (of all three types) and have the assembly descriptor put these dependent files in the "right" places in my image. In particular, the "wsr" files and "war" files go in one place, while the "jar" files go in another. While I am not having a problem specifying the dependencies in my pom file - since I can specify the element to request a "wsr" file as opposed to a "jar" file, I'm not able to, in my assembly descriptor, cause the filters to work properly. I have something like this: com.acme:wsr-artifact1 com.acme:war-artifact2 com.acme:wsr-artifact3 image/server/default/deploy false false image/server/default/lib false runtime What I'm expecting to have happen is all the dependencies that DON'T match the pattern in the moduleSet will get places into image/server/default/lib. But those that do match the moduleSet filter will get placed in image/server/default/deploy. The problem is that all dependencies end up in image/server/default/lib and nothing ends up in image/server/default/deploy and I always get a warning message during my the assembly phase to wit: [INFO] Processing DependencySet [WARNING] The following patterns were never triggered in this artifact inclusion filter: o 'com.acme:wsr-artifact1' [WARNING] NOTE: Currently, inclusion of module dependencies may produce unpredictable results if a version conflict occurs. What am I doing wrong? Is it possible to grab non-jar dependencies and distribute them in different directories as I'm trying to do? Thanks. -- Eric
RE: sjc (jaxb) plugin for jdk1.4
Thanks. I found the jaxb1-maven-plugin at org.codehaus, which is working for me fine. But I'll take a look at the one you cite, below as well. Thanks. -- Eric -Original Message- From: Aleksei Valikov [mailto:[EMAIL PROTECTED] Sent: Monday, October 09, 2006 1:18 AM To: Maven Users List Subject: Re: sjc (jaxb) plugin for jdk1.4 Hi. > I am trying to convert a large ant project to maven and the project (for > various reasons) is tied to jdk 1.4. There are several uses of xjc > (jaxb) and I wanted to use a maven jaxb plugin in order to build those > projects. However, the jaxb plugin available maven-jaxb-plugin > (com.sun.tools.xjc.maven2) requires the use of jdk 1.5. (It requires > source=1.5). Does there exist a jaxb plugin for maven2 that works with > jdk1.4? I'd rather not have to use an ant-task for my xjc code > generation. Thanks. -- Eric Here's one that we wrote and use extensively: https://maven-jaxb1-plugin.dev.java.net Bye. /lexi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: sjc (jaxb) plugin for jdk1.4
I found the jaxb1 maven plugin at: http://jira.codehaus.org/browse/MOJO-374. This appears to work fine with jdk 1.4. -- Eric From: Swenson, Eric Sent: Sunday, October 08, 2006 8:02 PM To: 'users@maven.apache.org' Subject: sjc (jaxb) plugin for jdk1.4 I am trying to convert a large ant project to maven and the project (for various reasons) is tied to jdk 1.4. There are several uses of xjc (jaxb) and I wanted to use a maven jaxb plugin in order to build those projects. However, the jaxb plugin available maven-jaxb-plugin (com.sun.tools.xjc.maven2) requires the use of jdk 1.5. (It requires source=1.5). Does there exist a jaxb plugin for maven2 that works with jdk1.4? I'd rather not have to use an ant-task for my xjc code generation. Thanks. -- Eric
sjc (jaxb) plugin for jdk1.4
I am trying to convert a large ant project to maven and the project (for various reasons) is tied to jdk 1.4. There are several uses of xjc (jaxb) and I wanted to use a maven jaxb plugin in order to build those projects. However, the jaxb plugin available maven-jaxb-plugin (com.sun.tools.xjc.maven2) requires the use of jdk 1.5. (It requires source=1.5). Does there exist a jaxb plugin for maven2 that works with jdk1.4? I'd rather not have to use an ant-task for my xjc code generation. Thanks. -- Eric
RE: Creating a .wsr file artifact
Well, I've made progress since my post. However, I still have an issue. I now have a maven-wsr-plugin, which I based on maven-war-plugin and I'm able to compile my project with: mvn compiler:compile and package my project (into a .wsr file) with: mvn wsr:wsr However, what I can't do is perform the compile/package/install automatically by simply doing: mvn install This works for jar and war files. But for my wsr files, it doesn't. When I attempt either an: mvn compile or mvn install I get the error: $ mvn compile [INFO] Scanning for projects... [INFO] [INFO] Building NemoPersonalizationService [INFO]task-segment: [compile] [INFO] [INFO] [ERROR] BUILD ERROR [INFO] [INFO] Cannot find lifecycle mapping for packaging: 'wsr'. Component descriptor cannot be found in the component repository: org.apache.maven.lifecycle.mapping.LifecycleMappingwsr. or $ mvn install [INFO] Scanning for projects... [INFO] [INFO] Building NemoPersonalizationService [INFO]task-segment: [install] [INFO] [INFO] [ERROR] BUILD ERROR [INFO] [INFO] Cannot find lifecycle mapping for packaging: 'wsr'. Component descriptor cannot be found in the component repository: org.apache.maven.lifecycle.mapping.LifecycleMappingwsr. If my pom uses jar I'm able to use "mvn compile" or "mvn package" or "mvn install". How can I enable this for my maven-wsr-plugin (e.g. pom files with wsr? -- Eric -Original Message- From: Swenson, Eric Sent: Friday, October 06, 2006 5:53 PM To: dev@maven.apache.org Subject: Creating a .wsr file artifact I'm using Maven 2.0.4 and need to produce a .wsr file. A .wsr file is a jboss web service archive and is very similar to a .war file, a .sar file, and an .ear file. I've tried two tacts so far, neither successful. The first approach was to take the mavin-war-plugin sources, renaming all instances of "war" to "wsr" and using it. I had to make a copy of the WarArchiver class (org.codehaus.plexus.archiver.WarArchiver) and rename it, too, to WsrArchiver in order to get the generated plugin.xml to not refer to WarArchiver. However, I was never able to get this plugin to work. I kept getting errors telling me that the life cycle manager could not find a mapping for "wsr". I gave up and tried to figure out how to get maven to simply rename the artifact after the package goal - I went back to using war files. I wanted to simply rename this from a war file to a wsr file. But I could never figure out how to do that. It would appear that the in an (I used "zip") also dictated the file extension placed on the output of the assembly. Can someone give me some hints on how to accomplish what I need to do? I would actually like to get the mavin-wsr-plugin to work because I'd like to be able to add more wsr-related smarts to the packaging (there are additional files in a wsr that are not in a war). But I can't figure out how to get a copy of mavin-war-plugin to work with the *only* change being that the file extension of the artifact is changed to "wsr" (from "war"). Can anyone help? -- Eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Renaming an artifact
I'm using Maven 2.0.4 and need to produce a .wsr file. A .wsr file is a jboss web service archive and is very similar to a .war file, a .sar file, and an .ear file. I've tried two tacts so far, neither successful. The first approach was to take the mavin-war-plugin sources, renaming all instances of "war" to "wsr" and using it. I had to make a copy of the WarArchiver class (org.codehaus.plexus.archiver.WarArchiver) and rename it, too, to WsrArchiver in order to get the generated plugin.xml to not refer to WarArchiver. However, I was never able to get this plugin to work. I kept getting errors telling me that the life cycle manager could not find a mapping for "wsr". I gave up and tried to figure out how to get maven to simply rename the artifact after the package goal - I went back to using war files. I wanted to simply rename this from a war file to a wsr file. But I could never figure out how to do that. It would appear that the in an (I used "zip") also dictated the file extension placed on the output of the assembly. Can someone give me some hints on how to accomplish what I need to do? I would actually like to get the mavin-wsr-plugin to work because I'd like to be able to add more wsr-related smarts to the packaging (there are additional files in a wsr that are not in a war). But I can't figure out how to get a copy of mavin-war-plugin to work with the *only* change being that the file extension of the artifact is changed to "wsr" (from "war"). Can anyone help? -- Eric