dev@glassfish.java.net

Re: How do I use gf:run?

From: Byron Nevins <Byron.Nevins_at_Sun.COM>
Date: Wed, 08 Oct 2008 12:21:58 -0700
I don't know where your pom file is located.  But if it doesn't inherit directly from <ws>/v3/pom.xml then you will have trouble because "distribution-fragment" is a V3 defined type.



Vivek Pandey wrote:
Is there any document/blog that talks about how to use gf:run or glassfish:run from a maven project? Is this supposed to work with the v3-prelude?

I had my old Scala/Lift post[1] where I talked about using gf:run to deploy a Lift app in iterative mode. I notice that I was using

        <plugins>
            <plugin>
                <groupId>org.glassfish</groupId>
                <artifactId>maven-glassfish-plugin</artifactId>
                <version>1.0-alpha-4</version>
                <configuration>
                    <resourcesDirectory>target/liftapp-${project.version}</resourcesDirectory>
                </configuration>
            </plugin>
        </plugins>

Now I see two incarnation of maven-glassfish-plugin, one at [2] and the other one is part of v3 workspace 
and is used in the glassfish build system. [2] is quite different and it expects a glassfish installation 
to be present. 

I replaced the above maven snippet with the one that is part of v3 workspace:

       <plugin>
         <groupId>org.glassfish.build</groupId>
         <artifactId>maven-glassfish-plugin</artifactId>
         <version>10.0-alpha-5-SNAPSHOT</version>
         <configuration>
          <!-- configuration for the checkout mojo -->
            <checkoutDirectory>.</checkoutDirectory>
            <skipCheckoutIfExists>true</skipCheckoutIfExists>
            <!-- configuration for the run mojo -->
            <distribution>
                <groupId>org.glassfish.distributions</groupId>
                <artifactId>web</artifactId>
                <version>10.0-SNAPSHOT</version>
            </distribution>

             <resourcesDirectory>target/liftapp-${project.version}</resourcesDirectory>
         </configuration>
      </plugin>

       <extensions>
            <extension>
                <groupId>org.glassfish.build</groupId>
                <artifactId>maven-glassfish-extension</artifactId>
                <version>1.0-SNAPSHOT</version>
            </extension>
        </extensions>

But at the end of the run I see that the gf:run fails with this exception (distribution-fragment):

Downloading: http://scala-tools.org/repo-releases/org/glassfish/admingui/dist-fragment/10.0-SNAPSHOT/dist-fragment-10.0-SNAPSHOT.distribution-fragment
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve dependencies of distribution POM

Embedded error: Missing:
----------
1) org.glassfish.osgi-platforms:felix:distribution-fragment:10.0-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.glassfish.osgi-platforms -DartifactId=felix -Dversion=10.0-SNAPSHOT -Dpackaging=distribution-fragment -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.glassfish.osgi-platforms -DartifactId=felix -Dversion=10.0-SNAPSHOT -Dpackaging=distribution-fragment -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
      1) org.glassfish.distributions:web:pom:10.0-SNAPSHOT
      2) org.glassfish.distributions:nucleus:zip:10.0-SNAPSHOT
      3) org.glassfish.osgi-platforms:felix:distribution-fragment:10.0-SNAPSHOT

2) org.glassfish.docs:basedocs:distribution-fragment:0.2-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.glassfish.docs -DartifactId=basedocs -Dversion=0.2-SNAPSHOT -Dpackaging=distribution-fragment -Dfile=/path/to/file


How do I workaround or what is the right usage to run glassfish from my maven project file?

-vivek.


[1]http://weblogs.java.net/blog/vivekp/archive/2008/05/scala_lift_web.html
[2]https://maven-glassfish-plugin.dev.java.net/
--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: dev-help@glassfish.dev.java.net

-- 
Byron Nevins Work 408-276-4089, Home 650-359-1290, Cell 650-784-4123 - Sun Microsystems, Inc.