Search code examples
javamaven-2jakarta-eeglassfishglassfish-3

How m2eclipse create a new domain by maven-glassfish-plugin?


version is glassfish v3

I want to trying maven-glassfish-plugin but I don't know how to create a new domain.


Solution

  • You can use the create-domain command. Either pass parameters on the command line or follow the interactive steps:

    $ asadmin create-domain
    

    But the Maven GlassFish Plugin (once properly configured) can also create a domain with the following goal:

    glassfish:create-domain Create a new Glassfish domain. (Creating an existing domain will cause it to be deleted and recreated.)

    Here is a configuration sample (inspired by the Fairly Complete Configuration Example):

    <plugin>
      <groupId>org.glassfish.maven.plugin</groupId>
      <artifactId>maven-glassfish-plugin</artifactId>
      <version>2.2-SNAPSHOT</version>
      <configuration>
        <glassfishDirectory>${glassfish.home}</glassfishDirectory>
        <user>${domain.username}</user>
        <adminPassword>${domain.password}</adminPassword>
        <!-- <passwordFile>path/to/asadmin/passfile</passwordFile> -->
        <autoCreate>true</autoCreate>
        <debug>true</debug>
        <echo>true</echo>
        <skip>${test.int.skip}</skip>
        <domain>
          <name>${project.artifactId}</name>
          <httpPort>8080</httpPort>
          <adminPort>4848</adminPort>
        </domain>
        <components>
          <component>
            <name>${project.artifactId}</name>
            <artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
          </component>
        </components>
      </configuration>
    </plugin>