You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Bracewell, Robert" <rb...@qualcomm.com> on 2009/05/22 20:40:04 UTC

Generating a jar multiple times using classifiers

Hi,

How do people approach the need to generate a jar multiple times using classifiers.
My specific requirement is that I have a module which needs to be built against Axis2 1.3 and Axis2 1.4 and have 2 jars in the repo with distinct classifiers.
I can get this to work using profiles but this only ever runs the module once and then I have to run again with a different profile.

I've been thinking of generating a src package for the module and then define two new modules that depend on the src dependency and thus build out the required artifact and both artifacts would be deployed during the release phase as well

Thanks,
Robert


RE: Generating a jar multiple times using classifiers

Posted by Martin Gainty <mg...@hotmail.com>.
the StudioEclipseMojo updates manifest.mf (with updateManifest method)
here is the code:
+			final List<Artifact> artifactList = createArtifactList();
+
+			// Update Bundle-Classpath in MANIFEST.MF
+			updateManifest(artifactList);

+	private void updateManifest(final List<Artifact> list)
+			throws FileNotFoundException, IOException {
+		final File manifestFile = new File(project.getBasedir(),
+				"META-INF/MANIFEST.MF");
+
+		// Build Bundle-ClassPath entry
+		final StringBuilder bundleClasspath = new StringBuilder(" .");
+		for (Artifact artifact : list) 
                 {
//append all the filenames found in the list...
+			bundleClasspath.append(",").append(NEWLINE).append(" ").append(
+					classpathPrefix).append(File.separator).append(
+					artifact.getFile().getName());
+		}

//as long as the scope is NOT provided the outputted list will include the item
+	private List<Artifact> createArtifactList() {
+		List<Artifact> list = new ArrayList<Artifact>();
+		for (Iterator<Artifact> artifactItem = project.getArtifacts()
+				.iterator(); artifactItem.hasNext();) {
+			Artifact artifact = (Artifact) artifactItem.next();
+			if (!artifact.getScope().equalsIgnoreCase("provided")) {
+				list.add(artifact);
+			}
+		}
+		return list;
+	}

http://mail-archives.apache.org/mod_mbox/directory-commits/200712.mbox/%3C20071204215855.4B5001A9838@eris.apache.org%3E

usually a build engineer builds one version of source for 1.0 named module-1.0-src.jar
next iteration which is version 1.1 may be called 1.1 named module-1.1-src.jar

same with binaries which do not have a -src suffix for the same set of deployed jars containing config and .class
 usually a build engineer builds one version of source for 1.0 named module-1.0.jar

next iteration which is version 1.1 may be called 1.1 named module-1.1.jar


at the very least I would update manifest.mf which represents all characteristics of that jar with 'classifier' although that clearly breaks naming convention most (of us) developers are used to

does this help?
Martin 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> From: rbracewe@qualcomm.com
> To: users@maven.apache.org
> Date: Fri, 22 May 2009 11:40:04 -0700
> Subject: Generating a jar multiple times using classifiers
> 
> Hi,
> 
> How do people approach the need to generate a jar multiple times using classifiers.
> My specific requirement is that I have a module which needs to be built against Axis2 1.3 and Axis2 1.4 and have 2 jars in the repo with distinct classifiers.
> I can get this to work using profiles but this only ever runs the module once and then I have to run again with a different profile.
> 
> I've been thinking of generating a src package for the module and then define two new modules that depend on the src dependency and thus build out the required artifact and both artifacts would be deployed during the release phase as well
> 
> Thanks,
> Robert
> 

_________________________________________________________________
Hotmail® goes with you. 
http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009