In the Fairly Complete Configuration Example, there is indeed a reference to the <passFile>
element but the documentation of the various goals doesn't mention this element and refer to <passwordFile>
instead (see for example glassfish:start-domain or glassfish:deploy). So, try to update the configuration of your plugin in your profile accordingly:
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.2-SNAPSHOT</version>
<configuration>
<glassfishDirectory>${glassfish.directory}</glassfishDirectory>
<user>${glassfish.user}</user>
<passwordFile>${glassfish.directory}/domains/${project.artifactId}/config/domain-passwords</passwordFile>
<domain>
<name>${project.artifactId}</name>
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/artifacts/${project.artifactId}.war</artifact>
</component>
</components>
</configuration>
</plugin>
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 <glassfish_home>/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:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>maven-glassfish-testcase</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>maven-glassfish-testcase Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<glassfish.home>/home/pascal/opt/glassfishv3/glassfish</glassfish.home>
<domain.username>admin</domain.username>
</properties>
<pluginRepositories>
<pluginRepository>
<id>ocean</id>
<url>http://maven.ocean.net.au/snapshot</url>
<releases>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>maven-glassfish-testcase</finalName>
<plugins>
<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>
<passwordFile>${glassfish.home}/domains/${project.artifactId}/master-password</passwordFile>
<debug>true</debug>
<echo>true</echo>
<domain>
<name>${project.artifactId}</name>
<adminPort>4848</adminPort> <!-- mandatory for mvn glassfish:deploy -->
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
</configuration>
</plugin>
</plugins>
</build>
</project>
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!