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?
> >
>