On Tue, 15 Mar 2011 12:42:23 -0700, Marshall Schor <[email protected]> wrote:
On 3/3/2011 7:47 AM, Greg Holmberg wrote:
I'm converting all my annotators to PEAR packaging. I like having
everything
in one file, especially when there are many additional files that are
part of
the annotator--resources, config, data, etc. It just makes it a lot
easier to
consume the annotator.
So I'm using the PEAR packaging maven plug-in. This works fine, but I
was
surprised when the PEAR file didn't get installed (i.e. it didn't show
up
under ~/.m2/repository). It seems like a reasonable expectation--you
build a
jar artifact, it gets installed/deployed; you build a PEAR artifact, it
should
get installed/deployed.
It appears I can make it happen with an explicit deploy command.
mvn deploy:deploy-file -Durl=<my-repo> -Dfile=myannotator.PEAR
-DgroupId=com.me.group -DartifactId=myannotator -Dversion=1.0
-Dpackaging=pear
But I'm not sure how I can make this happen automatically as part of
the mvn
build. Can I specify <type>pear<type> in the pom? That would require
someone
to register a lifecycle for the pear type, which no one has done, right?
I don't think this requires registering a lifecycle for pears. You can
add some
configuration to the build section of the pom for the project to
"attach" the
pear file to the build output, so it will get deployed; see for example
the
build-helper maven plugin goal attach-artifact.
Great suggestion, Marshall. I got my pear file deployed using that.
Here's the pom snippet for the producing maven project:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-pear</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}.pear</file>
<type>pear</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
A related question. Are there plans to deliver the annotators in UIMA
(both
core and contributed in the SandBox) as PEAR files in the Apache nexus
repository? I.e., so that an analysis engine developer could simply
state a
dependency on a set of PEAR artifacts, and get them automatically
pulled down
to his local drive (.m2/repository)?
Not that I know of, but this sounds like an interesting idea :-) .
Then, the consuming maven project adds this to its pom.xml, which will
cause the .pear file to be downloaded from the nexus server.
<dependencies>
<dependency>
<groupId>com.me.uima</groupId>
<artifactId>MyAnnotator</artifactId>
<version>${project.version}</version>
<type>pear</type>
</dependency>
</dependencies>
Then the question would be how to reference the .pear files from the AAE
descriptor. By name, I suppose, and then manage the datapath variable
to
include the paths into .m2/repository with the correct artifact version
numbers.
This is the part I haven't figured out yet. Reading the docs on pear
files, it appears it is necessary to go through an installation process.
I was really hoping to be able to just use a pear file as it comes from
nexus, no unpacking, no modification--just read-only reference. In other
words, just point to the pear file (unzipped) in my .m2/repository
directory from an AAE descriptor, with no installation process.
Am I dreaming, or is there some way I could make that happen? By managing
classpath and datapath, somehow?
Or should I proceed directly to OSGI, do not pass pear, do not collect
$200? :-)
Thanks,
Greg