fabric_pkg -fabric-jar option

dsb012 
Joined: 09/17/2009
User offline. Last seen 44 weeks 20 hours ago.

What happened to the -fabric-jar option in fabric_pkg?

It's listed on the online documentation for 3.9 but isn't part of 4.1:

Usage: fabric_pkg command [options] [xml-file|package-file]
Appistry Fabric Application Packager - v4.1.0.21 (Aug 9 2009)

options for [create,check]
-classpath used to locate classes/jars that are not packaged with the app
-fabric-home used to locate fabric jars, will be used instead of environment variable FABRIC_HOME
-fars-dir used to locate the fars directory
-verbose enable verbose output

I have a maven plugin that I wrote to package applications and we need to specify the location of the appistry fabric.jar which we store in a maven repo. I really don't want to have to have appistry installed on my build machine or setup a special directory structure to provide a single jar to fabric_package.

Thanks,
David

tcat.seq  Appistry employee
Joined: 03/11/2008
User offline. Last seen 7 weeks 6 days ago.

Assumption I'm going to make: The maven plugin that your wrote packages your app into a ".fabric" file.
Given the above assumption, would adding fabric.jar as a dependency in your maven plugin's pom.xml get what you are looking for since you have added it to your Maven repo.

Question: Are you using some class from fabric.jar when your maven plugin packages a app (say, maven goal "fabric:package") to a .fabric file? I don't see why you would need to. Perhaps you could throw in some details since I may have not fully understood your question.

Thanks,
RAS

dsb012 
Joined: 09/17/2009
User offline. Last seen 44 weeks 20 hours ago.

Yes the plug-in generates .fabric files.

I guess my issue is really not maven specific it's just how I found this issue.

My main question is related to the documentation for fabric_pkg. The online documentation has -fabric-jar as a command option:

http://www.appistry.com/community/wiki/display/eaf39dev/fabric_pkg+comma...

But when I run fabric_pkg it tells me the following options which are different:

options for [create,check]
-classpath used to locate classes/jars that are not packaged with the app
-fabric-home used to locate fabric jars, will be used instead of environment variable FABRIC_HOME
-fars-dir used to locate the fars directory
-verbose enable verbose output

It seems you've removed fabric-jar and replaced it with fabric-home. The documentation says that fabric_home is used to locate fabric jars. The -fabric-jar option was much more useful because I could explicitly point to the appistry fabric.jar in my maven repo.

-David

tcat.seq  Appistry employee
Joined: 03/11/2008
User offline. Last seen 7 weeks 6 days ago.

Yes, the -fabric-jar option has been removed with 4.x. You could use -fabric-home or -classpath.

But given that you are using Maven, one approach would be to do the following:

  1. Add a dependency to your application pom.xml as follows:
          <dependencies>
    		<dependency>
    			<groupId>com.appistry</groupId> <!-- replace with the groupId  you used when you installed/deployed the artifact to your repo -->
    			<artifactId>fabric</artifactId>  <!-- replace with appropriate artifactId -->
    			<version>4.0.2.4</version>   <!-- replace with appropriate version -->
    		</dependency>
          <dependencies>
  2. Next, add the maven-dependency-plugin to the build section and configure it to copy the "dependencies" to say "target/fabric-resources" directory (or which ever directory your Maven plugin is going to package the app from).
        <build>
            <plugins>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-dependency-plugin</artifactId>
    				<version>2.0</version>
    				<executions>
    					<execution>
    						<id>copy-required-dependencies</id>
    						<phase>install</phase>
    						<goals>
    							<goal>copy-dependencies</goal>
    						</goals>
    						<configuration>
    							<excludeGroupIds>org.jmock,junit</excludeGroupIds>
    							<!-- <stripVersion>true</stripVersion> -->
    							<outputDirectory>
    								${project.build.directory}/fabric-resources
    							</outputDirectory>
    						</configuration>
    					</execution>
    				</executions>
    			</plugin>
            </plugins>
        </build>

    OR, better yet, your maven plugin could invoke the executeMojo(...) method for the "copy-dependencies" goal of the "maven-dependency-plugin" to say "target/fabric-resources" directory and then execute fabric_pkg command on "target/fabric-resources" directory.

  3. On a side note, if your application references classes from fabric.jar you will only need it at build time since fabric.jar is available to the fabric app when it is running in CloudIQ. Therefore I would recommend that you do not include it in your .fabric file.

    Does this help?

    Thanks,
    RAS