首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用通配符maven-plugin创建安全域没有任何影响。

使用通配符maven-plugin创建安全域没有任何影响。
EN

Stack Overflow用户
提问于 2015-06-30 18:45:44
回答 1查看 1.1K关注 0票数 2

我在它的命令中找到了使用/subsystem,所以我尝试使用一个不同的子系统命令(我用一个来创建安全域),它成功地构建了,但是在standalone.xml中没有任何影响。

代码语言:javascript
复制
        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>1.1.0.Alpha1</version>
            <configuration>
                <execute-commands>
                    <commands>
                        <command>/subsystem=security/security-domain=secureD:add(cache-type=default)</command>
                        <command>reload</command>
                        <command>/subsystem=security/security-domain=secureD/authentication=classic:add(login-modules=[{"code"=>"Database","flag"=>"required","module-options"=>[("dsJndiName"=>"java:jboss/datasources/MyDB"),("principalsQuery"=>"select password from Users where username=?"),("rolesQuery"=>"select role, 'Roles' from Users where username=?"),("hashAlgorithm"=>"SHA-256"),("hashEncoding"=>"hex"),("hashCharset"=>"UTF-8")]}])</command>
                        <command>reload</command>
                    </commands>
                </execute-commands>
            </configuration>
        </plugin>

当我在$ ./jboss-cli.sh --connect中手动执行命令时,它可以工作,并且域是创建的。

我在以下运行配置中使用了eclipse:“目标:干净包、通配符:部署”"Profiles: local“

代码语言:javascript
复制
<project ...
    ...
    <build>
        <plugins>
            <plugin>
                tried pasting code from above once here
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>local</id>
            <properties>
                ...
            </properties>
            <build>
                <plugins>
                    <plugin>
                            and once here 
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

在构建时,我会得到以下错误:

代码语言:javascript
复制
...
[INFO] 
[INFO] --- wildfly-maven-plugin:1.0.1.Final:undeploy (undeploy) @ Project ---
Jul 03, 2015 3:50:36 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.2.0.Final
Jul 03, 2015 3:50:36 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.2.0.Final
Jul 03, 2015 3:50:36 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.0.Final
WARN: can't find jboss-cli.xml. Using default configuration values.
Jul 03, 2015 3:50:36 PM org.jboss.as.cli.impl.CommandContextImpl printLine
INFO: {"outcome" => "success"}
{"outcome" => "success"}
Jul 03, 2015 3:50:36 PM org.jboss.as.cli.impl.CommandContextImpl printLine
INFO: {
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.316 s
[INFO] Finished at: 2015-07-03T15:50:36+01:00
[INFO] Final Memory: 12M/165M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.1.Final:undeploy (undeploy) on project Project: Could not execute goal undeploy on /home/username/workspace/Project/target/Project-0.0.1-SNAPSHOT.war. Reason: Command execution failed for command 'reload'. Unsupported ModelControllerClient implementation org.wildfly.plugin.cli.Commands$NonClosingModelControllerClient -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

如果删除reload命令,就会得到:

代码语言:javascript
复制
...
WARN: can't find jboss-cli.xml. Using default configuration values.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.825 s
[INFO] Finished at: 2015-07-03T15:45:23+01:00
[INFO] Final Memory: 22M/214M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.1.Final:deploy-artifact (deploy_jdbc_driver) on project Project: Could not execute goal deploy-artifact on /home/username/.m2/repository/mysql/mysql-connector-java/5.1.35/mysql-connector-java-5.1.35.jar. Reason: Command execution failed for command '/subsystem=security/security-domain=secureD:add(cache-type=default)'. {
[ERROR] "outcome" => "failed",
[ERROR] "failure-description" => "JBAS014803: Duplicate resource [
[ERROR] (\"subsystem\" => \"security\"),
[ERROR] (\"security-domain\" => \"secureD\")
[ERROR] ]",
[ERROR] "rolled-back" => true,
[ERROR] "response-headers" => {"process-state" => "reload-required"}
[ERROR] }
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
EN

回答 1

Stack Overflow用户

发布于 2015-07-02 16:44:39

您需要添加wildfly:execute-commands目标或更改配置以使用<before-deployment/>。后者可能是一个更好的解决方案,因为您必须使用执行来确保在部署之前执行这些命令。我也只会在最后使用reload

代码语言:javascript
复制
<configuration>
    <before-deployment>
        <commands>
            <command>/subsystem=security/security-domain=secureD:add(cache-type=default)</command>
            <command>/subsystem=security/security-domain=secureD/authentication=classic:add(login-modules=[{"code"=>"Database","flag"=>"required","module-options"=>[("dsJndiName"=>"java:jboss/datasources/MyDB"),("principalsQuery"=>"select password from Users where username=?"),("rolesQuery"=>"select role, 'Roles' from Users where username=?"),("hashAlgorithm"=>"SHA-256"),("hashEncoding"=>"hex"),("hashCharset"=>"UTF-8")]}])</command>
            <command>reload</command>
        </commands>
    </before-deployment>
</configuration>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31146058

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档