与Maven一起从头开始构建CAS战争



我是Maven的新手,但已经与Ant合作多年,最近与Gradle合作了相当广泛。

我正在尝试克隆并构建(本地)一个名为Apereo(以前的Jasig)中央身份验证服务(CAS)的Maven项目。这是一个Java Web应用程序,在SSO服务中扮演票务商店(类似于Kerberos)的角色。通常,要将 CAS 用作 SSO 服务器,默认情况下使用 Maven 覆盖方法拉入其 JAR/WAR,如果要提供自己的自定义文件,只需覆盖这些默认值。

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

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:ih8windowscastargetcas-server-4.1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Webapp assembled in [213 msecs]
[INFO] Building war: D:ih8windowscastargetcas-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不是实现这一目标的方法,那是什么?

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

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

最新更新