Sorry - "m-assembly-p" im not familliar with that abbreviation. So - going back to a simple example, I used the example on including module sources here: http://maven.apache.org/plugins/maven-assembly-plugin/examples/multimodule/module-source-inclusion-simple.html
Based on that, my src.xml looks like this: <assembly xmlns=" http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> <id>src</id> <formats> <format>dir</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <moduleSets> <moduleSet> <includes> <include>myCompany:OC4J_TNM_BE.ear</include> <include>myCompany:OC4J_TNM_BE.rar</include> </includes> <sources> <outputDirectory>sources/${artifactId}</outputDirectory> </sources> </moduleSet> </moduleSets> </assembly> The top level pom has this: <modules> <module>OC4J_TNM_BE.war</module> <module>OC4J_TNM_BE.ear</module> <module>OC4J_TNM_BE.rar</module> </modules> <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.2-beta-5</version> <configuration> <descriptors> <descriptor>src/assemble/src.xml</descriptor> </descriptors> </configuration> </plugin> </plugins> </build> I run: mvn clean package with no errors then I run: mvn assembly:directory and it creates the sources folder just fine. SO I change the src.xml as follows, to add a binaries option <moduleSet> <includes> <include>myCompany:OC4J_TNM_BE.ear</include> <include>myCompany:OC4J_TNM_BE.rar</include> </includes> <sources> <outputDirectory>sources/${artifactId}</outputDirectory> </sources> <binaries> <outputDirectory>bin</outputDirectory> <unpack>false</unpack> </binaries> </moduleSet> Then I re-run: mvn assembly:directory and I get the following output: [INFO] [assembly:directory {execution: default-cli}] [INFO] Reading assembly descriptor: src/assemble/src.xml [WARNING] [DEPRECATION] Use of <moduleSources/> as a file-set is deprecated. Please use the <fileSets/> sub-element of <moduleSource s/> instead. [INFO] Processing sources for module project: myCompany:OC4J_TNM_BE.ear:ear:1.0 [INFO] Processing sources for module project: myCompany:OC4J_TNM_BE.rar:rar:1.0 [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error creating assembly: Artifact: myCompany:OC4J_TNM_BE.rar:rar:1.0 (included by module) does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated. Theres been no changes other than adding 4 lines to the src.xml assembly descriptor. I verified the rar file is present in the project's output directory. I also tried running mvn install to put things in my local repository, but I still get the same error. Now also - since the best practice is to put the packaging in its own project, I created a _package project, and moved the assembly stuff into there. >From the top level pom I run: mvn package no errors, everything is built like I expect. the _package project pom.xml has this: <?xml version="1.0" encoding="UTF-8"?> <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"> <modelVersion>4.0.0</modelVersion> <groupId>myCompany</groupId> <artifactId>OC4J_TNM_BE_package</artifactId> <version>1.0</version> <name>${Component}_package</name> <packaging>pom</packaging> <parent> <artifactId>OC4J_TNM_BE</artifactId> <groupId>myCompany</groupId> <version>1.0</version> </parent> <dependencies> <dependency> <groupId>myCompany</groupId> <artifactId>OC4J_TNM_BE.ear</artifactId> <version>1.0</version> <type>ear</type> </dependency> <dependency> <groupId>myCompany</groupId> <artifactId>OC4J_TNM_BE.rar</artifactId> <version>1.0</version> <type>rar</type> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.2-beta-5</version> <configuration> <descriptors> <descriptor>src/assemble/src.xml</descriptor> </descriptors> </configuration> </plugin> </plugins> </build> </project> the src.xml file is the same as I listed above. Now when I move to the _package project and run: mvn assembly:directory, I get the following: [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building OC4J_TNM_BE_package [INFO] task-segment: [assembly:directory] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Preparing assembly:directory [INFO] ------------------------------------------------------------------------ [INFO] Building OC4J_TNM_BE_package [INFO] ------------------------------------------------------------------------ [INFO] [site:attach-descriptor {execution: default-attach-descriptor}] [INFO] [assembly:directory {execution: default-cli}] [INFO] Reading assembly descriptor: src/assemble/src.xml [WARNING] The following patterns were never triggered in this artifact inclusion filter: o 'myCompany:OC4J_TNM_BE.ear' o 'myCompany:OC4J_TNM_BE.rar' [WARNING] [DEPRECATION] Use of <moduleSources/> as a file-set is deprecated. Please use the <fileSets/> sub-element of <moduleSource s/> instead. [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error creating assembly: Error creating assembly archive src: You must set at least one file. [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7 seconds [INFO] Finished at: Tue Sep 21 11:07:51 PDT 2010 [INFO] Final Memory: 17M/254M [INFO] ------------------------------------------------------------------------ What am I missing here? On Mon, Sep 20, 2010 at 9:28 PM, Anders Hammar <and...@hammar.net> wrote: > Di you use the correct goal of m-assembly-p? Read the docs carefully! > > /Anders > > On Tue, Sep 21, 2010 at 01:23, Jon Paynter <kittl...@gmail.com> wrote: > > > Well this kinda works... > > I made another project as a sibling, moved the assembly stuff from the > > parent pom into the new project. but now when I run mvn package I get > the > > following: > > > > [INFO] Building OC4J_TNM_BE_package > > [INFO] > > ------------------------------------------------------------------------ > > [WARNING] Removing: assembly from forked lifecycle, to prevent recursive > > invocation. > > [INFO] [site:attach-descriptor {execution: default-attach-descriptor}] > > [INFO] [assembly:assembly {execution: Make-OC4JDistribution}] > > [INFO] Reading assembly descriptor: src/assemble/OC4JDistribution.xml > > [WARNING] The following patterns were never triggered in this artifact > > inclusion filter: > > o 'myCompany:OC4J_TNM_BE.rar' > > o 'myCompany:OC4J_TNM_BE.ear' > > [WARNING] The following patterns were never triggered in this artifact > > inclusion filter: > > o 'myCompany:OC4J_TNM_BE.rar' > > o 'myCompany:OC4J_TNM_BE.ear' > > [WARNING] NOTE: Currently, inclusion of module dependencies may produce > > unpredictable results if a version conflict occurs. > > [INFO] Copying files to C:\Documents and > > Settings\xxxx\OC4J_TNM_BE\OC4J_TNM_BE_package\target\dev > > [WARNING] Assembly file: C:\Documents and > > Settings\xxxx\OC4J_TNM_BE\OC4J_TNM_BE_package\target\dev is not a regular > > file (it may be a directory). It cannot be attached to the project build > > for > > installation or deployment. > > > > It looks like the assembly is being called twice. anyone know why that > is? > > but more importandly -- why cant it find my modules? > > > > I just want the ear and rar binaries to be included in the assembly. I > > tried the built-in descriptorRef 'bin' but that gave an error saying it > > cant find anything because its only looking for jar files. > > > > > > > > On Mon, Sep 20, 2010 at 1:19 PM, Jon Paynter <kittl...@gmail.com> wrote: > > > > > Actually the top pom i posted is in the 2nd level of my project > hierarchy > > > that ive created. The other modules generate normal jar files. Its > the > > > OC4J components that were giving me greif so I isolated that one. > > > > > > so to move the assembly to its own module - that would mean something > > like > > > this: > > > <modules> > > > <module>OC4J_TNM_BE.war</module> > > > <module>OC4J_TNM_BE.ear</module> > > > <module>OC4J_TNM_BE.rar</module> > > > <module>OC4J_TNM_BE_package</module> > > > </modules> > > > > > > Where the package module would depend on the ear, war and rar modules. > > Or > > > do I put the packager module in a different spot in the directory tree? > > > > > > Also - what do i need to look out for when setting up this pattern to > > > handle 20+ OC4J components? > > > > > > On Mon, Sep 20, 2010 at 11:54 AM, Anders Hammar <and...@hammar.net> > > wrote: > > > > > >> The solution is to put the assembly in a separate module. This is best > > >> practice. > > >> I guess your "top pom" (the aggregator pom) is the parent pom as well, > > >> right? In that case, it has to be built first and that would make the > > >> assembly plugin run before any module has been built. This should be > > easy > > >> to > > >> spot in the console output. > > >> > > >> This problem has been discussed at least twice over the last month. > > >> Clearly > > >> there is a need to stress this FAQ entry: > > >> > > >> > > > http://maven.apache.org/plugins/maven-assembly-plugin/faq.html#module-binaries > > >> > > >> /Anders > > >> > > >> On Mon, Sep 20, 2010 at 20:26, Jon Paynter <kittl...@gmail.com> > wrote: > > >> > > >> > Thanks for the reply -- > > >> > > > >> > My local repo is empty -- this case by design. when building a > clean > > >> (or > > >> > new) version, the assembly should take the file thats recently > > changed, > > >> and > > >> > not an older version sitting in the repository. > > >> > > > >> > I put the revelant (I think) files here: > > >> > http://gist.github.com/588355 > > >> > > > >> > If that doesnt work, let me know and i'll just post them in this > email > > >> > thread. > > >> > The end goal is to somewhat duplicate our existing ant build where > all > > >> > revalant files are copied to a folder named Release/${envType}/ and > > the > > >> > appropiate structure created. > > >> > The assembly xml file I posted puts all the files for a single OC4J > > >> > component into the proper directories, so that part works okay. > > >> > > > >> > And again -- if theres a better way to accomplish what im trying to > > do, > > >> let > > >> > me know. Im very new to maven. > > >> > > > >> > Thanks, > > >> > Jon. > > >> > > > >> > On Mon, Sep 20, 2010 at 11:01 AM, Nayan Hajratwala < > na...@chikli.com> > > >> > wrote: > > >> > > > >> > > Have you looked in your local maven repo to see if the artifact is > > >> where > > >> > > you think it is? According to this output, your war file should > > exist > > >> in: > > >> > > > > >> > > > > >> > <home>/.m2/repository/myCompany/OC4J_TNM_BE/1.0/OC4J_TNM_BE-1.0.war > > >> > > > > >> > > However, as stephane noted, you should probably be building > > >> 1.0-SNAPSHOT, > > >> > > not 1.0.. > > >> > > > > >> > > Can you post your whole pom? It would probably make it much > quicker > > to > > >> > > detect the problem. An easy place to share stuff like this is: > > >> > > http://gist.github.com/ > > >> > > > > >> > > --- > > >> > > Nayan Hajratwala > > >> > > http://agileshrugged.com > > >> > > http://twitter.com/nhajratw > > >> > > 734.658.6032 > > >> > > > > >> > > On Sep 20, 2010, at 1:03 PM, Jon Paynter wrote: > > >> > > > > >> > > > After posting, I kept investigating on my side and the problem > > seems > > >> to > > >> > > be > > >> > > > in the assembly plugin.. not the ear plugin. I have the > following > > >> > > section > > >> > > > in my top level pom: > > >> > > > > > >> > > > <build> > > >> > > > <plugins> > > >> > > > <plugin> > > >> > > > <artifactId>maven-assembly-plugin</artifactId> > > >> > > > <inherited>false</inherited> > > >> > > > <configuration> > > >> > > > > > <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions> > > >> > > > <appendAssemblyId>false</appendAssemblyId> > > >> > > > <finalName>${envType}</finalName> > > >> > > > <descriptors> > > >> > > > > > >> <descriptor>src/assemble/OC4JDistribution.xml</descriptor> > > >> > > > </descriptors> > > >> > > > </configuration> > > >> > > > <!-- > > >> > > > <executions> > > >> > > > <execution> > > >> > > > <id>Make-OC4JDistribution</id> > > >> > > > <phase>package</phase> > > >> > > > <goals> > > >> > > > <goal>assembly</goal> > > >> > > > </goals> > > >> > > > </execution> > > >> > > > </executions> > > >> > > > --> > > >> > > > </plugin> > > >> > > > </plugins> > > >> > > > </build> > > >> > > > With the executions commented out, all builds fine. but when I > > run > > >> mvn > > >> > > > assembly:assembly or uncomment the execution, then I get the > > >> previous > > >> > > error > > >> > > > if running maven 3.1, or the following if im running 2.2.1: > > >> > > > > > >> > > > C:\Documents and Settings\xxxx\OC4J_TNM_BE>mvn assembly:assembly > > >> > > > [INFO] Scanning for projects... > > >> > > > [INFO] Reactor build order: > > >> > > > [INFO] OC4J_TNM_BE > > >> > > > [INFO] OC4C_TNM_BE war > > >> > > > [INFO] OC4C_TNM_BE ear > > >> > > > [INFO] OC4C_TNM_BE rar > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [INFO] Building OC4J_TNM_BE > > >> > > > [INFO] task-segment: [assembly:assembly] (aggregator-style) > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [INFO] Preparing assembly:assembly > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [INFO] Building OC4J_TNM_BE > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [INFO] [site:attach-descriptor {execution: > > >> default-attach-descriptor}] > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [INFO] Building OC4C_TNM_BE war > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [INFO] [resources:resources {execution: default-resources}] > > >> > > > [INFO] Using 'UTF-8' encoding to copy filtered resources. > > >> > > > [INFO] Copying 0 resource > > >> > > > [INFO] [compiler:compile {execution: default-compile}] > > >> > > > [INFO] No sources to compile > > >> > > > [INFO] [resources:testResources {execution: > > default-testResources}] > > >> > > > [INFO] Using 'UTF-8' encoding to copy filtered resources. > > >> > > > [INFO] Copying 0 resource > > >> > > > [INFO] [compiler:testCompile {execution: default-testCompile}] > > >> > > > [INFO] No sources to compile > > >> > > > [INFO] [surefire:test {execution: default-test}] > > >> > > > [INFO] Surefire report directory: C:\Documents and > > >> > > > > Settings\xxxx\OC4J_TNM_BE\OC4J_TNM_BE.war\target\surefire-reports > > >> > > > ------------------------------------------------------- > > >> > > > T E S T S > > >> > > > ------------------------------------------------------- > > >> > > > There are no tests to run. > > >> > > > Results : > > >> > > > Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 > > >> > > > [INFO] [war:war {execution: default-war}] > > >> > > > [INFO] Packaging webapp > > >> > > > [INFO] Assembling webapp [OC4J_TNM_BE.war] in [C:\Documents and > > >> > > > Settings\xxxx\OC4J_TNM_BE\OC4J_TNM_BE.war\target\OC4C_TNM_BEWeb > > >> > > > [INFO] Processing war project > > >> > > > [INFO] Copying webapp webResources [C:\Documents and > > >> > > > > Settings\xxxx\OC4J_TNM_BE\OC4J_TNM_BE.war/src/main/webapp/WEB-INF] > > >> to > > >> > > [C:\ > > >> > > > cuments and > > >> > > Settings\xxxx\OC4J_TNM_BE\OC4J_TNM_BE.war\target\OC4C_TNM_BEWeb] > > >> > > > [INFO] Copying webapp resources [C:\Documents and > > >> > > > Settings\xxxx\OC4J_TNM_BE\OC4J_TNM_BE.war\src\main\webapp] > > >> > > > [INFO] Webapp assembled in [500 msecs] > > >> > > > [INFO] Building war: C:\Documents and > > >> > > > > > Settings\xxxx\OC4J_TNM_BE\OC4J_TNM_BE.war\target\OC4C_TNM_BEWeb.war > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [INFO] Building OC4C_TNM_BE ear > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > Downloading: > > >> > > > > > >> > > > > >> > > > >> > > > http://repo1.maven.org/maven2/myCompany/OC4J_TNM_BE.war/1.0/OC4J_TNM_BE.war-1.0.war > > >> > > > [INFO] Unable to find resource > 'myCompany:OC4J_TNM_BE.war:war:1.0' > > >> in > > >> > > > repository central (http://repo1.maven.org/maven2) > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [ERROR] BUILD ERROR > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [INFO] Failed to resolve artifact. > > >> > > > Missing: > > >> > > > ---------- > > >> > > > 1) myCompany:OC4J_TNM_BE.war:war:1.0 > > >> > > > Try downloading the file manually from the project website. > > >> > > > Then, install it using the command: > > >> > > > mvn install:install-file -DgroupId=myCompany > > >> > > > -DartifactId=OC4J_TNM_BE.war -Dversion=1.0 -Dpackaging=war > > >> > > > -Dfile=/path/to/file > > >> > > > Alternatively, if you host your own repository you can deploy > the > > >> file > > >> > > > there: > > >> > > > mvn deploy:deploy-file -DgroupId=myCompany > > >> > > > -DartifactId=OC4J_TNM_BE.war -Dversion=1.0 -Dpackaging=war > > >> > > > -Dfile=/path/to/file -Dur > > >> > > > [url] -DrepositoryId=[id] > > >> > > > Path to dependency: > > >> > > > 1) myCompany:OC4J_TNM_BE.ear:ear:1.0 > > >> > > > 2) myCompany:OC4J_TNM_BE.war:war:1.0 > > >> > > > ---------- > > >> > > > 1 required artifact is missing. > > >> > > > for artifact: > > >> > > > myCompany:OC4J_TNM_BE.ear:ear:1.0 > > >> > > > from the specified remote repositories: > > >> > > > central (http://repo1.maven.org/maven2) > > >> > > > > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [INFO] For more information, run Maven with the -e switch > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > [INFO] Total time: 47 seconds > > >> > > > [INFO] Finished at: Mon Sep 20 10:00:18 PDT 2010 > > >> > > > [INFO] Final Memory: 17M/254M > > >> > > > [INFO] > > >> > > > > > >> > > > ------------------------------------------------------------------------ > > >> > > > C:\Documents and Settings\xxxx\OC4J_TNM_BE> > > >> > > > > > >> > > > > > >> > > > On Sat, Sep 18, 2010 at 7:25 AM, Stephane Nicoll > > >> > > > <stephane.nic...@gmail.com>wrote: > > >> > > > > > >> > > >> It should work but your project's version should be something > > like > > >> > > >> 1.0-SNAPSHOT, not 1.0. > > >> > > >> > > >> > > >> That being said, it could be a thing as simple as a typo so > > posting > > >> > your > > >> > > >> project somewhere would help. > > >> > > >> > > >> > > >> S. > > >> > > >> > > >> > > >> On Fri, Sep 17, 2010 at 11:46 PM, Jon Paynter < > > kittl...@gmail.com> > > >> > > wrote: > > >> > > >> > > >> > > >>> Hi -- ive been tasked with looking to see if maven will work > to > > >> > replace > > >> > > >> our > > >> > > >>> current ant build. > > >> > > >>> > > >> > > >>> Since our company makes extensive use of j2ee and OC4J > > components, > > >> > that > > >> > > >> was > > >> > > >>> one of the first thigns I tackled after getting some basic > > modules > > >> to > > >> > > >>> compile. > > >> > > >>> > > >> > > >>> In keeping with our existing ant build structure I setup the > > >> > following > > >> > > >> tree > > >> > > >>> structure: > > >> > > >>> OC4J pom.xml > > >> > > >>> | > > >> > > >>> |--- OC4J.ear > > >> > > >>> | > > >> > > >>> |--- OC4J.rar > > >> > > >>> | > > >> > > >>> |--- OC4J.war > > >> > > >>> > > >> > > >>> The ear is setup with a dependancy on the war file. > > >> > > >>> If goto the top level folder and run: mvn compile -- all is > > fine. > > >> no > > >> > > >>> errors. > > >> > > >>> > > >> > > >>> but when I goto the top level folder and run: mvn package > > >> > > >>> I get an error when building the ear file saying it cant find > > the > > >> war > > >> > > >> file: > > >> > > >>> > > >> > > >>> [ERROR] Failed to execute goal on project OC4J.ear: Could not > > >> resolve > > >> > > >>> dependencies for project cdrive:OC4J.ear:ear:1.0: The > following > > >> > > artifacts > > >> > > >>> could not be resolved: cdrive:OC4J.war:war:1.0: Failure to > find > > >> > > >>> cdrive:OC4J.war:war:1.0 in http://repo1.maven.org/maven2 was > > >> cached > > >> > in > > >> > > >> the > > >> > > >>> local repository. Resolution will not be reattempted until the > > >> update > > >> > > >>> interval of central has elapsed or updates are forced. -> > [Help > > 1] > > >> > > >>> > > >> > > >>> > > >> > > >>> I started this endevor using maven 2.2.1 but I had the same > > >> problems > > >> > > with > > >> > > >>> ear generation. searching led me to a post back from 2007 > where > > >> > > somebody > > >> > > >>> had the exact same problem, but there was no resolution > posted. > > I > > >> > was > > >> > > >>> hoping maven 3.0 would fix the issue, but it just gives > > different > > >> > error > > >> > > >>> messages. > > >> > > >>> > > >> > > >>> > > >> > > >>> So my questions are as follows: > > >> > > >>> > > >> > > >>> 1) Is there a better way to do this? -- if so it needs to > scale > > >> > well, > > >> > > >> the > > >> > > >>> project has about 20 OC4J components. > > >> > > >>> 2) if not, how do I fix the dependancies so this will work? > > >> > > >>> 3) if neither... will this be fixed in maven 3.0? > > >> > > >>> > > >> > > >> > > >> > > > > >> > > > > >> > > > > --------------------------------------------------------------------- > > >> > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > >> > > For additional commands, e-mail: users-h...@maven.apache.org > > >> > > > > >> > > > > >> > > > >> > > > > > > > > >