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 <[email protected]> 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 <[email protected]> > 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 > > > <[email protected]>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 <[email protected]> > > 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: [email protected] > > For additional commands, e-mail: [email protected] > > > > >
