GlassFish v3 and glassfish-maven-plugin (Mac)

后端 未结 2 1766
星月不相逢
星月不相逢 2020-12-28 10:44

I\'m trying to use the glassfish-maven-plugin (https://maven-glassfish-plugin.dev.java.net/) with GlassFish v3 (I\'m on a Mac and using Eclipse) and I can\'t seem to get my

2条回答
  •  旧巷少年郎
    2020-12-28 11:24

    In the Fairly Complete Configuration Example, there is indeed a reference to the element but the documentation of the various goals doesn't mention this element and refer to instead (see for example glassfish:start-domain or glassfish:deploy). So, try to update the configuration of your plugin in your profile accordingly:

    
      org.glassfish.maven.plugin
      maven-glassfish-plugin
      2.2-SNAPSHOT
      
        ${glassfish.directory}
        ${glassfish.user}
        ${glassfish.directory}/domains/${project.artifactId}/config/domain-passwords
        
          ${project.artifactId}
        
        
          
            ${project.artifactId}
            ${project.build.directory}/artifacts/${project.artifactId}.war
          
        
      
    
    

    As a side note, I recommend the maven-embedded-glassfish-plugin which allows to run Glassfish in a single JVM using its embedded API. Very nice. See Using maven plugin for v3 embedded glassfish for more details.

    UPDATE: I did some further testing and, couldn't actually reproduce your problem on my machine (sigh).

    First, I created a new domain by executing the following command (from /bin):

    $ ./asadmin create-domain  --savemasterpassword=true maven-glassfish-testcase
    

    Then, I created a new webapp using maven's webapp archetype:

    $ mvn archetype:create -DgroupId=com.mycompany.app \
          -DartifactId=maven-glassfish-testcase \
          -DarchetypeArtifactId=maven-archetype-webapp
    

    And updated the pom.xml of the freshly created webapp as follow:

    
      4.0.0
      com.mycompany.app
      maven-glassfish-testcase
      war
      1.0-SNAPSHOT
      maven-glassfish-testcase Maven Webapp
      http://maven.apache.org
      
        /home/pascal/opt/glassfishv3/glassfish
        admin
      
      
        
          ocean
          http://maven.ocean.net.au/snapshot
          
            false
            never
          
          
            true
            always
          
        
      
      
        
          junit
          junit
          3.8.1
          test
        
      
      
        maven-glassfish-testcase
        
          
            org.glassfish.maven.plugin
            maven-glassfish-plugin
            2.2-SNAPSHOT
            
              ${glassfish.home}
              ${domain.username}
              ${glassfish.home}/domains/${project.artifactId}/master-password
              true
              true
              
                ${project.artifactId}
                4848 
              
              
                
                  ${project.artifactId}
                  ${project.build.directory}/${project.build.finalName}.war
                
              
            
          
        
      
    
    

    With this setup, running mvn glassfish:start-domain produces the following output:

    $ mvn glassfish:start-domain
    [INFO] Scanning for projects...
    [INFO] snapshot org.glassfish.maven.plugin:maven-glassfish-plugin:2.2-SNAPSHOT: checking for updates from ocean
    [INFO] ------------------------------------------------------------------------
    [INFO] Building maven-glassfish-testcase Maven Webapp
    [INFO]    task-segment: [glassfish:start-domain]
    [INFO] ------------------------------------------------------------------------
    [INFO] [glassfish:start-domain {execution: default-cli}]
    [INFO] asadmin --host localhost --port 4848 --user admin --passwordfile /home/pascal/opt/glassfishv3/glassfish/domains/maven-glassfish-testcase/master-password --interactive=false --echo=true --terse=true start-domain --debug=true --domaindir /home/pascal/opt/glassfishv3/glassfish/domains --help=false --upgrade=false --verbose=false maven-glassfish-testcase
    [INFO] Started domain: maven-glassfish-testcase
    [INFO] Domain location: /home/pascal/opt/glassfishv3/glassfish/domains/maven-glassfish-testcase
    [INFO] Log file: /home/pascal/opt/glassfishv3/glassfish/domains/maven-glassfish-testcase/logs/server.log
    [INFO] Admin port for the domain: 4848
    [INFO] Debug port for the domain: 9009
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 27 seconds
    [INFO] Finished at: Mon Dec 21 20:16:17 CET 2009
    [INFO] Final Memory: 4M/53M
    [INFO] ------------------------------------------------------------------------
    

    As you can see, the --passwordfile option is passed correctly using the file specified in the POM. In other words, things are working as expected. Maybe try with an hard coded path to the password file to debug this setting, it should just work!

提交回复
热议问题