How to create a tar distribution of binary modules and dependencies using Assembly
Greetings, I've tried to setup the Assembly plug-in to create a master tar file with both my application jars and the dependencies used during compilation (stripping the version numbers from the resulting jars) without much success. Based on the documentation (http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_binaries, http://maven.apache.org/plugins/maven-assembly-plugin/advanced-module-set-topics.html) I set my assembly file as follows: ?xml version=1.0? assembly xmlns= http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation= http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd; !-- http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html -- idbin/id formats formattar/format /formats includeBaseDirectoryfalse/includeBaseDirectory moduleSets moduleSet includes includemygroup:*/include /includes binaries outputDirectorymygroup/outputDirectory includeDependenciestrue/includeDependencies dependencySets dependencySet outputFileNameMapping${artifact.artifactId}/outputFileNameMapping unpackfalse/unpack useProjectArtifacttrue/useProjectArtifact scopecompile/scope /dependencySet /dependencySets /binaries /moduleSet /moduleSets /assembly But when I call mvn assembly:single I get the following error: To refactor, move this assembly into a child project and use the flag useAllReactorProjectstrue/useAllReactorProjects in each moduleSet. [INFO] [INFO] Reactor Summary: [INFO] [INFO] mygroup .. FAILURE [1.582s] [INFO] BLAH .. SKIPPED [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 4.115s [INFO] Finished at: Tue Feb 07 16:25:45 EST 2012 [INFO] Final Memory: 10M/233M [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2:single (default-cli) on project mygroup: Failed to create assembly: Artifact: mygroup:BLAH:jar:20120120-PRODUCTION (included by module) does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated. - [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException Any ideas on how to accomplish this? Thanks in advance, --Jose ___ This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing. Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent from other members of the Barclays Group. ___
Maven 3.0.3, Classifier, maven-metadata.xml, versioningSnapshot, and TeamCity
Gents, Thank you for any assistance in advance. I'm completely out of ideas, as are the folks at TeamCity. This may be a maven deploy plugin issue, all opinions/insights are welcome and appreciated. At the very highest level I need to be able to continuously deploy linux and windows jars and let a build running on either linux or windows resolve those deployed jars. My setup looks like this (mostly because of matlab licensing fun): pom.xml modules=A, B \A pom file + java code \B pom file + java code \C pom.xml + modules=D, E \C\D pom file + matlab code \C\E pom file + matlab code So when I build my root pom.xml file I do a mvn deploy at the root which deploys A and B. When I do a mvn deploy on C it deploys D and E. B and C need the jars from D and E. When doing a mvn deploy on C OS-dependent jar files are deployed to an apache archiva repository (I've tried sonatype, had the same issue, so I don't think it's an archiva problem). The OS-dependent specification is done by adding the classifier tag in the maven-jar-plugin in C's pom.xml: build plugins plugin artifactIdmaven-jar-plugin/artifactId version${maven.jar.plugin.version}/version configuration classifier${envClassifier}/classifier /configuration /plugin /plugins /build where envClassifier is defined in the root pom.xml file depending on the current operating system (we deploy windows and linux jars, only 64-bit). I've also updated the maven-deploy-plugin version in the root pom.xml file to version 2.7 (I tried the latest snapshot too, to no avail). The updated maven-deploy-plugin also references the classifier, without this the deployed maven-metadata.xml file did not have the versioningSnapshot information needed to resolve dependencies and only the last deployed OS jars were found. build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-deploy-plugin/artifactId version2.7/version configuration classifier${envClassifier}/classifier /configuration /plugin /plugins /build Now we come full force to the issue at hand. I have 4 TeamCity build configurations, 1 that deploys A on windows, 1 that deploys A on linux, 1 that deploys C on windows, and 1 that deploys C on linux. Deploying A is done continuously on every commit (if the build agents can keep up, A is a fast build). Deploying C on windows and linux is (currently) done by manually triggering the build on the build server such that they both start at the same time and therefore are (hopefully) based on the same svn revision (we average a commit every ~20 minutes, so that seems ok for now). Most of the time the deployed maven-metadata.xml file seems to eventually get corrupted and loses all its versioningSnapshot information, so I end up with the below as my maven-metadata.xml. It has been very difficult to ascertain when the maven-metadata.xml file gets corrupted, it seems somewhat random. Recently I have seen it get corrupted after a deploy on A, but looking at that build log it doesn't show any updating of C, D, or E's maven metadata. So I really don't know why it keeps getting hosed and after it's hosed dependencies cannot be resolved when building A on either linux or windows (but not both, whichever OS last deployed, that OS build for A can still resolve dependencies). Also the good maven-metadata.xml file only seems to have 1 classifier, so maybe that's not even good enough? i.e. In the Good maven-metadata.xml example below there is only a linux classifier. Hosed maven-metadata.xml: metadata groupIdcom.foo/groupId artifactIdE/artifactId version4.0-SNAPSHOT/version versioning snapshot buildNumber325/buildNumber timestamp20111205.181820/timestamp /snapshot lastUpdated20111205181820/lastUpdated /versioning /metadata Good maven-metadata.xml: metadata modelVersion=1.1.0 groupIdcom.foo/groupId artifactIdD/artifactId version4.0-SNAPSHOT/version versioning snapshot timestamp20111205.200259/timestamp buildNumber328/buildNumber /snapshot lastUpdated20111205200259/lastUpdated snapshotVersions snapshotVersion extensionpom/extension value4.0-20111205.200259-328/value updated20111205200259/updated /snapshotVersion snapshotVersion classifierlinux/classifier extensionjar/extension value4.0-20111205.200259-328/value updated20111205200259/updated /snapshotVersion snapshotVersion
RE: How to create a tar distribution of binary modules and dependencies using Assembly
All, I figured it out, this does exactly what I need: ?xml version=1.0? assembly xmlns= http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation= http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd; !-- http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html -- idbin/id formats formattar.bz2/format /formats includeBaseDirectoryfalse/includeBaseDirectory moduleSets moduleSet includes includemygroup:*/include /includes binaries outputDirectorymygroup/outputDirectory unpackfalse/unpack outputFileNameMapping${artifact.artifactId}/outputFileNameMapping includeDependenciestrue/includeDependencies /binaries /moduleSet /moduleSets /assembly Then you call 'mvn package assembly:assembly' Regards, --Jose -Original Message- From: Nunez Zuleta, Jose V: IT (NYK) Sent: Wednesday, February 08, 2012 11:28 AM To: users@maven.apache.org Subject: How to create a tar distribution of binary modules and dependencies using Assembly Greetings, I've tried to setup the Assembly plug-in to create a master tar file with both my application jars and the dependencies used during compilation (stripping the version numbers from the resulting jars) without much success. Based on the documentation (http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_binaries, http://maven.apache.org/plugins/maven-assembly-plugin/advanced-module-set-topics.html) I set my assembly file as follows: ?xml version=1.0? assembly xmlns= http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation= http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd; !-- http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html -- idbin/id formats formattar/format /formats includeBaseDirectoryfalse/includeBaseDirectory moduleSets moduleSet includes includemygroup:*/include /includes binaries outputDirectorymygroup/outputDirectory includeDependenciestrue/includeDependencies dependencySets dependencySet outputFileNameMapping${artifact.artifactId}/outputFileNameMapping unpackfalse/unpack useProjectArtifacttrue/useProjectArtifact scopecompile/scope /dependencySet /dependencySets /binaries /moduleSet /moduleSets /assembly But when I call mvn assembly:single I get the following error: To refactor, move this assembly into a child project and use the flag useAllReactorProjectstrue/useAllReactorProjects in each moduleSet. [INFO] [INFO] Reactor Summary: [INFO] [INFO] mygroup .. FAILURE [1.582s] [INFO] BLAH .. SKIPPED [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 4.115s [INFO] Finished at: Tue Feb 07 16:25:45 EST 2012 [INFO] Final Memory: 10M/233M [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2:single (default-cli) on project mygroup: Failed to create assembly: Artifact: mygroup:BLAH:jar:20120120-PRODUCTION (included by module) does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated. - [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException Any ideas on how to accomplish this? Thanks in advance, --Jose ___ This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means.
Maven/M2E and eclipse projects.
Posted this question to stackoverflow first, but then figured chances of question read by knowledgeable people is much higher here. We use maven/m2e/eclipse combo for our work. We start with importing master maven pom file in eclipse and our projects get imported. Our source control system is set up to ignore eclipse generated project files as we don't want to check in anything generated. It all works nicely and not problems on this end. What we would like to do is set up some common eclipse preferences for all the projects to ensure standard coding style across all developers and follow java best practices. Example is reorganize imports setting in eclipse, reformat code when file is saved, and standard line widths (we prefer 120 characters as against standard 80 eclipse default) It seems like m2e can be configured to generate some of these settings using project configurator, but could not find any examples. Any thoughts how we can achieve this functionality? It would be much nicer to have project specific entries generated from maven pom configuration and everyone will share same settings automatically. I don't mind writing some code for the m2extension, but I am not familiar with eclipse guts and don't know what needs to be done. With many thanks in advance, - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Maven/M2E and eclipse projects.
We use maven/m2e/eclipse combo for our work. We start with importing master maven pom file in eclipse and our projects get imported. Our source control ... It seems like m2e can be configured to generate some of these settings using project configurator, but could not find any examples. m2e is a product from the Eclipse Foundation. Please contact them for your support needs: http://www.eclipse.org/m2e/ Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Error assembling JAR. jar is read-only.
I am using TFS 2010 and the Maven build extension. I have many working builds in place. I have a new one, however, that compiles source code but then fails when it tries to create a jar file. I have googled my fingers to the bone. Does anyone have a suggestion? BTW, I can run a Maven build manually on the build server on top of the source pulled over by TFS, and the manual build works fine. Also, the jar that is read-only is created by the Maven build. (And it is read-only when built with TFS and not read-only when built manually.) [INFO] Scanning for projects... [INFO] [INFO] Building Services-Core [INFO] task-segment: [install] [INFO] [INFO] [resources:resources {execution: default-resources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] [compiler:compile {execution: default-compile}] [INFO] Compiling 23 source files to C:\Builds\7\Services-Core\test4\Sources\web\WEB-INF\classes [INFO] [resources:testResources {execution: default-testResources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 10 resources [INFO] [compiler:testCompile {execution: default-testCompile}] [INFO] Not compiling test sources [INFO] [surefire:test {execution: default-test}] [INFO] Tests are skipped. [INFO] [jar:jar {execution: default-jar}] [INFO] [ERROR] BUILD ERROR [INFO] [INFO] Error assembling JAR Embedded error: C:\Builds\7\Services-Core\test4\Sources\target\Services-Core-1.0.0.jar is read-only. [INFO] [INFO] For more information, run Maven with the -e switch [INFO] [INFO] Total time: 3 seconds [INFO] Finished at: Wed Feb 08 23:21:35 GMT 2012 [INFO] Final Memory: 18M/45M [INFO]