我使用maven-glassfish-plugin创建一个新域但文件不存在主密码?为什么?命令为glassfish:start-domain
。我的pom.xml
声明了以下内容:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
<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>
<finalName>SSH2Maven</finalName>
</build>
例外是:IoException
答案 0 :(得分:3)
我不确定glassfish插件是否可以在创建域时将主密码保留在文件中。
但是你可以在命令行上执行此操作:
$ asadmin change-master-password --savemasterpassword=true my-domain Please enter the new master password> Please enter the new master password again> Master password changed for domain my-domain
重要的部分是--savemasterpassword=true
(将生成的文件放在任何地方)。
作为参考,您还可以在命令行上创建域时执行此操作:
$ asadmin create-domain --savemasterpassword=true my-domain