On Mon, 11 Jul 2005, Edward Yakop wrote:

> Hi all,
>
> I'm having difficulties setting up 'ear' project.
> The following are the conditions:
>
> The pom file:
> --------------------------------------------------------------------------------
> <project>
>   <modelVersion>4.0.0</modelVersion>
>   ...
>   <packaging>ear</packaging>
>   ...
> </project>
> --------------------------------------------------------------------------------
>
> Directory structure:
> --------------------------------------------------------------------------------
> .
> |-- pom.xml
> `-- src
>     `-- application
>         `-- META-INF
>             `-- application.xml
> --------------------------------------------------------------------------------
> Note: Why application.xml needs to be put under src/application, instead of
> src/main/application?

Because the plugin developer decided so ;) This plugin doesn't have a test
phase, so it's no use having the file in src/main/ (because
src/test/application is never consulted).

You can override this setting by specifying

<configuration>

<applicationXmlLocation>src/main/application/application.xml</applicationXmlLocation>
</configuration>

for the plugin.

[snip]

> Notice at the start of m2 output:
> --------------------------------------------------------------------------------
> [ERROR] Nonexistent component:
> org.apache.maven.lifecycle.mapping.LifecycleMappingear
> [ERROR] No lifecycle mapping for type 'ear': using defaults
> --------------------------------------------------------------------------------
>
> And at the bottom of m2 output:
> --------------------------------------------------------------------------------
> [INFO] [jar:jar]
> [WARNING] JAR will be empty - no content was marked for inclusion!
> [INFO] Building jar: /home/efy/work/sample/target/sample-ear-1.0-SNAPSHOT.jar
> [INFO] [source:jar]
> [INFO] Not producing source bundle for a SNAPSHOT build
> [INFO] [install:install]
> [INFO] Installing /home/efy/work/sample/target/sample-ear-1.0-SNAPSHOT.ear to
> /home/efy/.m2/repository/com/test/sample/1.0-SNAPSHOT/sample-ear-1.0-SNAPSHOT.ear
> --------------------------------------------------------------------------------
>
> Is the reason m2 produced jar is because "ear" is not part lifecycle mapping?

It will produce both. The ear is currently no valid packaging, and has no
lifecyle mapping associated with it, so jar (the default) is used.

> And if that's the case, how do I patch the source code to make ear as one of 
> the
> lifecycle mapping?

You can patch
maven-core/src/main/resources/META-INF/plexus/components.xml but it
will get fixed eventually. But this is not necessary to get it to work.

As you can see in the lines below, the ear is installed:

> [INFO] Installing /home/efy/work/sample/target/sample-ear-1.0-SNAPSHOT.ear to
> /home/efy/.m2/repository/com/test/sample/1.0-SNAPSHOT/sample-ear-1.0-SNAPSHOT$


Currently, files in earSourceDirectory (src/application/) are included
in the ear, aswell as dependencies.

Maybe you can specify the complete POM? Did you check if the .ear file
exists, and what's in it?

For me the following worked:

      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.0-beta-1-SNAPSHOT</version>
        <executions>
          <execution>
            <goals>
              <goal>generate-application-xml</goal>
              <goal>ear</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

and specifying some dependencies (as type ejb or war). Just a pom, nothing
else in the project.

-- Kenney

>
> Regards,
> Edward
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to