maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Gomez" <henri.go...@gmail.com>
Subject custom packaging, how to get jars from wars
Date Tue, 04 Nov 2008 20:16:37 GMT
Hi to all,

I'm writing a custom packager to help my IT create ZIP archives from a
sum of jars/wars.

I could get the jars/wars but can't figure how to get the jars
required by wars (we didn't put them in WEB-INF/lib since we should
share them).

here is my actual code, how could I get jar dependencies from the WAR artifact ?

Thanks

---

   /**
    * Copy runtime wars
    * @throws MojoExecutionException
    */
   protected int copyWars() throws MojoExecutionException {

		int count = 0;

		try {
			Set artifacts = project.getArtifacts();
			for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
				Artifact artifact = (Artifact) iter.next();
				ScopeArtifactFilter filter = new ScopeArtifactFilter(
						Artifact.SCOPE_RUNTIME);
				if (!artifact.isOptional() && filter.include(artifact)
						&& "war".equals(artifact.getType())) {
					FileUtils.copyFileToDirectory(artifact.getFile(),
							warDirectory);

					count++;
				}
			}
		} catch (IOException e) {
			throw new MojoExecutionException("Error copying wars", e);
		}

		return (count);
	}

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message