I figured most of it out. The corrected POM snippet is below
I still have one final question; Is there a better way to write this
line :
<url>$
{project.distributionManagement.snapshotRepository.url}</url>
We should not have to be specific about which repo it is using.
And we should only have to set the varible in one place.
So there must be a better way to get the <url> element??
The corrected POM snippet ::
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<!-- do not create unique binaries for each
snapshot -->
<uniqueVersion>false</uniqueVersion>
</configuration>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<packaging>jar</packaging>
<!-- the Jar is generated by the War, and
so is down in the target webapp -->
<file>
${project.build.directory}/$
{project.artifactId}-${project.version}/WEB-INF/lib/$
{project.artifactId}-${project.version}.jar
</file>
<repositoryId>codehaus.org</repositoryId>
<!-- TODO :: this should not have to be
specific -->
<url>$
{project.distributionManagement.snapshotRepository.url}</url>
<pomFile>
${basedir}/pom.xml
</pomFile>
</configuration>
</execution>
</executions>
</plugin>
On Jul 2, 2008, at 9:52 PM, Chris Berry wrote:
Greetings,
I am generating several artifacts from my build; a WAR, a TAR.GZ,
and a JAR -- as required by downstream usage scenarios (embedded,
standalone, or webapp)
I am having trouble deploying the JAR properly. (Note: I had to add
an install:install-file section to my POM to get the JAR deployed
locally in the first place).
I have the project successfully generating all three artifacts (it
is a War project), and installing locally (mvn install). And I can
build dependent projects properly using the locally deployed artifacts
But when deploying the JAR remotely -- during the deploy phase --
the maven-deploy-plugin is overwriting my POM with a bogus one (see
below) which consists only of project basics; id, version, etc. - no
dependencies. This happens during the deploy:deploy-file phase for
the JAR. (See the POM snippet below). The generated bogus POM
causes downstream dependencies to fail during compilation.
I tried setting the <generatePOM> element to false, but it throws an
NPE (See below). Does this work?
I do not know how to set the <pomFile> element. Is there a variable
available for the POM file?? e.g. ${project.pom} ?? Or even a
variable available for the local repository - so I could point at
the file? e.g. {maven.local.repo} ??
I must be messing up the wiring?? But Google Univ. isn't giving me
any leads. ;-)
Anyone have any clues for me??
Thanks,
-- Chris
The snippet from my POM::
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<!-- do not create unique binaries for each
snapshot -->
<uniqueVersion>false</uniqueVersion>
</configuration>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<packaging>jar</packaging>
<artifactId>${project.artifactId}</
artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<file>
${project.build.directory}/$
{project.artifactId}-${project.version}/WEB-INF/lib/$
{project.artifactId}-${project.version}.jar
</file>
<repositoryId>codehaus.org</repositoryId>
<url>dav:https://dav.codehaus.org/snapshots.repository/atomserver/
</url>
<!-- <generatePom>false</generatePom> -->
<!-- <pomFile>${project.pom}</pomFile> -->
</configuration>
</execution>
</executions>
</plugin>
The bogus (empty) generated POM
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.atomserver</groupId>
<artifactId>atomserver</artifactId>
<version>2.0.2-SNAPSHOT</version>
</project>
The NPE from <generatePOM>false
[INFO] [deploy:deploy-file {execution: default}]
[INFO] Retrieving previous build number from codehaus.org
Uploading:
https://dav.codehaus.org/snapshots.repository/atomserver//org/atomserver/atomserver/2.0.2-SNAPSHOT/atomserver-2.0.2-SNAPSHOT.jar
[INFO] Retrieving previous metadata from codehaus.org
[INFO] Uploading repository metadata for: 'snapshot
org.atomserver:atomserver:2.0.2-SNAPSHOT'
[INFO] Retrieving previous metadata from codehaus.org
[INFO]
------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]
------------------------------------------------------------------------
[INFO] null
[INFO]
------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
at
hidden.org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:899)
at
org
.apache
.maven
.project
.artifact
.ProjectArtifactMetadata
.storeInLocalRepository(ProjectArtifactMetadata.java:86)
at
org
.apache
.maven
.artifact
.repository
.metadata
.DefaultRepositoryMetadataManager
.deploy(DefaultRepositoryMetadataManager.java:428)
at
org
.apache
.maven
.artifact
.deployer
.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:86)
at
org
.apache
.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.java:239)
at
org
.apache
.maven
.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:
447)
at
org
.apache
.maven
.lifecycle
.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:
539)
at
org
.apache
.maven
.lifecycle
.DefaultLifecycleExecutor
.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
at
org
.apache
.maven
.lifecycle
.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:
459)
at
org
.apache
.maven
.lifecycle
.DefaultLifecycleExecutor
.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at
org
.apache
.maven
.lifecycle
.DefaultLifecycleExecutor
.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at
org
.apache
.maven
.lifecycle
.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect
.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun
.reflect
.DelegatingMethodAccessorImpl
.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:
315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:
430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
S'all good --- chriswberry at gmail dot com
S'all good --- chriswberry at gmail dot com