使用Maven从零开始构建CAS战争

时间:2015-01-10 19:07:06

标签: java maven war cas

我是Maven的新手,但多年来一直与Ant合作,最近,与Gradle广泛合作。

我正在尝试克隆&构建(本地)一个名为Apereo(以前称为Jasig)的Maven项目Central Authentication Service (CAS)。这是一个Java Web应用程序,在SSO服务中扮演票证存储(类似于Kerberos)的角色。通常,要使用 CAS作为您的SSO服务器,默认情况下使用Maven覆盖方法来提取其JAR / WAR,如果您想提供自己的自定义文件,则只需覆盖这些默认值。 / p>

但这不是我想要的。我想在本地构建CAS项目,并对其进行自己的更改/调整。所以我从GitHub克隆它并在其根目录中发出mvn war:war" cas/"目录。我看到输出的 lot ,以:

结尾
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.jar (227 KB at 1423.8 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.4.3/xstream-1.4.3.jar (471 KB at 804.2 KB/sec)
[INFO] Packaging webapp
[INFO] Assembling webapp [cas-server] in [D:\ih8windows\cas\target\cas-server-4.1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Webapp assembled in [213 msecs]
[INFO] Building war: D:\ih8windows\cas\target\cas-server-4.1.0-SNAPSHOT.war
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apereo Central Authentication Service ............. FAILURE [ 11.779 s]
[INFO] Apereo CAS Core ................................... SKIPPED
[INFO] Apereo CAS Generic Support ........................ SKIPPED
[INFO] Apereo CAS Web Application support ................ SKIPPED
[INFO] Apereo CAS Web Application ........................ SKIPPED
[INFO] Apereo CAS JDBC Support ........................... SKIPPED
[INFO] Apereo CAS LDAP Support ........................... SKIPPED
[INFO] Apereo CAS Legacy Support ......................... SKIPPED
[INFO] Apereo CAS OpenId Server Support .................. SKIPPED
[INFO] Apereo CAS RADIUS Support ......................... SKIPPED
[INFO] Apereo CAS SPNEGO/NTLM Support .................... SKIPPED
[INFO] Apereo CAS Trusted User Support ................... SKIPPED
[INFO] Apereo CAS X.509 Client Certificate Support ....... SKIPPED
[INFO] Apereo CAS OAuth Server Support ................... SKIPPED
[INFO] Apereo CAS Client Protocols Support using pac4j ... SKIPPED
[INFO] Apereo CAS SAML Server and Validation Support ..... SKIPPED
[INFO] Apereo CAS JBoss Cache Integration - DEPRECATED ... SKIPPED
[INFO] Apereo CAS Memcached Integration .................. SKIPPED
[INFO] Apereo CAS Ehcache Integration .................... SKIPPED
[INFO] Apereo CAS Restlet Integration - DEPRECATED ....... SKIPPED
[INFO] Apereo CAS - Uber WAR - DEPRECATED ................ SKIPPED
[INFO] Apereo CAS ClearPass Extension .................... SKIPPED
[INFO] Apereo CAS Management Web Application ............. SKIPPED
[INFO] Apereo CAS REST Implementation .................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.142 s
[INFO] Finished at: 2015-01-10T13:56:35-05:00
[INFO] Final Memory: 24M/225M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.3:war (default-cli) on project cas-server: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [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

当我转到target/时,我看到cas-server-4.1.0-SNAPSHOT.war,但它是空的!

理想情况下,我希望其所有子项目都能将所有子项目捆绑在同一个工件(JAR / WAR)中。但如果那不可能,那么我需要建立&打包cas-server-webappcas-server-core子项目,以便我可以启动它们并在本地对它们进行更改。所以我问:如果mvn war:war不是实现这一目标的方式,那么它是什么?

1 个答案:

答案 0 :(得分:2)

而不是mvn war:war尝试在主目录中运行mvn package。它允许Maven为每个cas模块选择合适的包装类型。该项目由许多模块组成,并非所有模块都应打包为WAR。例如,父项目(失败的项目)具有pom打包类型,这意味着它不会构建任何东西,而是调用子模块。

mvn package完成后,您应该能够找到已汇编的cas-server-webapp/target/cas.war文件。