知乎专栏 |
当前 Java 是 OpenJDK 17
Neo-iMac:~ neo$ java -version openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment Homebrew (build 17.0.1+0) OpenJDK 64-Bit Server VM Homebrew (build 17.0.1+0, mixed mode, sharing)
代码中增加了
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <encoding>UTF-8</encoding> <java.version>1.8</java.version> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties>
仍如不能通过编译,提示:
An exception has occurred in the compiler (17.0.1). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you. com.sun.tools.javac.code.Symbol$CompletionFailure: class file for jakarta.validation.constraints.Pattern$Flag not found
这是因为有些第三方包依赖 OpenJDK 8 的一些包。安装 openjdk8 使用 1.8 编译问题得到解决。
export JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home mvn package
多线程下载 -Dmaven.artifact.threads=10 默认是 5
mvn -Dmaven.artifact.threads=10 test 您可以使用MAVEN_OPTS环境变量。例如: export MAVEN_OPTS = -Dmaven.artifact.threads = 10 MAVEN_OPTS = -Dmaven.repo.local=.m2/repository
创建 Maven 项目
mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.company -DartifactId=my-app
mvn archetype:create -DgroupId=packageName -DartifactId=webappName -DarchetypeArtifactId=maven-archetype-webapp
编译项目的源代码
$ mvn compile
编译测试的源代码
mvn test-compile
运行测试
$ mvn test
打包但不测试
mvn -D maven.test.skip=true package
忽略测试失败
mvn test -Dmaven.test.failure.ignore
将编译后的代码打包
$ mvn package
$ ls target/*.war target/www.netkiller.cn-0.0.1-SNAPSHOT.war
防止出现脏数据,可以先 clean 然后再打包,同时为了加快打包速度,逃过测试
mvn clean package -Dmaven.test.skip=true
将项目打包后安装到本地仓库,可以作为其它项目的本地依赖。
$ mvn install
跳过测试
mvn install -Dmaven.test.skip=true
安装jar到本地仓库
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> <path-to-file>: 要安装的JAR的本地路径 <group-id>: 要安装的JAR的Group Id <artifact-id>: 要安装的JAR的 Artificial Id <version>: JAR 版本 <packaging>: 打包类型,例如JAR
安装本地 path/to/your.jar 文件到Maven的.m2库中。
mvn install:install-file -Dfile=path/to/your.jar -DgroupId=com.example -DartifactId=project -Dversion=1.2.0 -Dpackaging=jar
$ mvn dependency:build-classpath [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building api.netkiller.cn 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-dependency-plugin:2.10:build-classpath (default-cli) @ api.cf88.com --- [INFO] Dependencies classpath: /www/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.3.0.RELEASE/spring-boot-starter-web-1.3.0.RELEASE.jar:......:/www/.m2/repository/junit/junit/4.12/junit-4.12.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.692 s [INFO] Finished at: 2016-08-10T17:32:49+08:00 [INFO] Final Memory: 25M/162M [INFO] ------------------------------------------------------------------------
[www@iZ62yln3rjjZ repository]$ mvn dependency:tree [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building api.example.com 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ api.cf88.com --- [INFO] cf88.com:api.cf88.com:jar:0.0.1-SNAPSHOT [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.3.0.RELEASE:compile [INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.3.0.RELEASE:compile [INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.0.RELEASE:compile [INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.3:compile [INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.3:compile [INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.13:compile [INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.13:compile [INFO] | | \- org.yaml:snakeyaml:jar:1.16:runtime [INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.3.0.RELEASE:compile [INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.28:compile [INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.28:compile [INFO] | | +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.28:compile [INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.28:compile [INFO] | +- org.springframework.boot:spring-boot-starter-validation:jar:1.3.0.RELEASE:compile [INFO] | | \- org.hibernate:hibernate-validator:jar:5.2.2.Final:compile [INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile [INFO] | | \- com.fasterxml:classmate:jar:1.1.0:compile [INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.3:compile [INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.3:compile [INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.6.3:compile [INFO] | +- org.springframework:spring-web:jar:4.2.3.RELEASE:compile [INFO] | | \- org.springframework:spring-aop:jar:4.2.3.RELEASE:compile [INFO] | | \- aopalliance:aopalliance:jar:1.0:compile [INFO] | \- org.springframework:spring-webmvc:jar:4.2.3.RELEASE:compile [INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.3.0.RELEASE:compile [INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.3.0.RELEASE:compile [INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.7:compile [INFO] | +- org.hibernate:hibernate-entitymanager:jar:4.3.11.Final:compile [INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile [INFO] | | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile [INFO] | | +- org.hibernate:hibernate-core:jar:4.3.11.Final:compile [INFO] | | | +- antlr:antlr:jar:2.7.7:compile [INFO] | | | \- org.jboss:jandex:jar:1.1.0.Final:compile [INFO] | | +- dom4j:dom4j:jar:1.6.1:compile [INFO] | | | \- xml-apis:xml-apis:jar:1.0.b2:compile [INFO] | | +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile [INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile [INFO] | | \- org.javassist:javassist:jar:3.18.1-GA:compile [INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile [INFO] | +- org.springframework.data:spring-data-jpa:jar:1.9.1.RELEASE:compile [INFO] | | \- org.springframework:spring-orm:jar:4.2.3.RELEASE:compile [INFO] | \- org.springframework:spring-aspects:jar:4.2.3.RELEASE:compile [INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.3.0.RELEASE:compile [INFO] | +- org.apache.tomcat:tomcat-jdbc:jar:8.0.28:compile [INFO] | | \- org.apache.tomcat:tomcat-juli:jar:8.0.28:compile [INFO] | \- org.springframework:spring-jdbc:jar:4.2.3.RELEASE:compile [INFO] +- org.springframework.boot:spring-boot-starter-redis:jar:1.3.0.RELEASE:compile [INFO] | +- org.springframework.data:spring-data-redis:jar:1.6.1.RELEASE:compile [INFO] | | \- org.springframework:spring-context-support:jar:4.2.3.RELEASE:compile [INFO] | \- redis.clients:jedis:jar:2.7.3:compile [INFO] | \- org.apache.commons:commons-pool2:jar:2.4.2:compile [INFO] +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:1.3.0.RELEASE:compile [INFO] | \- org.mongodb:mongo-java-driver:jar:2.13.3:compile [INFO] +- org.springframework.boot:spring-boot-starter-amqp:jar:1.3.0.RELEASE:compile [INFO] | +- org.springframework:spring-messaging:jar:4.2.3.RELEASE:compile [INFO] | \- org.springframework.amqp:spring-rabbit:jar:1.5.2.RELEASE:compile [INFO] | +- org.springframework.retry:spring-retry:jar:1.1.2.RELEASE:compile [INFO] | +- org.springframework.amqp:spring-amqp:jar:1.5.2.RELEASE:compile [INFO] | +- com.rabbitmq:http-client:jar:1.0.0.RELEASE:compile [INFO] | | \- org.apache.httpcomponents:httpclient:jar:4.5.1:compile [INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile [INFO] | | \- commons-codec:commons-codec:jar:1.9:compile [INFO] | \- com.rabbitmq:amqp-client:jar:3.5.6:compile [INFO] +- org.springframework.boot:spring-boot-devtools:jar:1.3.0.RELEASE:compile [INFO] | +- org.springframework.boot:spring-boot:jar:1.3.0.RELEASE:compile [INFO] | \- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.0.RELEASE:compile [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.3.0.RELEASE:test [INFO] | +- org.mockito:mockito-core:jar:1.10.19:test [INFO] | | \- org.objenesis:objenesis:jar:2.1:test [INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test [INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test [INFO] | +- org.springframework:spring-core:jar:4.2.3.RELEASE:compile [INFO] | \- org.springframework:spring-test:jar:4.2.3.RELEASE:test [INFO] +- org.springframework.data:spring-data-mongodb:jar:1.8.1.RELEASE:compile [INFO] | +- org.springframework:spring-tx:jar:4.2.3.RELEASE:compile [INFO] | +- org.springframework:spring-context:jar:4.2.3.RELEASE:compile [INFO] | +- org.springframework:spring-beans:jar:4.2.3.RELEASE:compile [INFO] | +- org.springframework:spring-expression:jar:4.2.3.RELEASE:compile [INFO] | +- org.springframework.data:spring-data-commons:jar:1.11.1.RELEASE:compile [INFO] | +- org.slf4j:slf4j-api:jar:1.7.13:compile [INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.13:compile [INFO] +- mysql:mysql-connector-java:jar:5.1.37:compile [INFO] +- com.google.code.gson:gson:jar:2.3.1:compile [INFO] \- junit:junit:jar:4.12:test [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.400 s [INFO] Finished at: 2016-08-09T10:25:07+08:00 [INFO] Final Memory: 23M/163M [INFO] ------------------------------------------------------------------------
$ mvn dependency:copy-dependencies
$ ls target/dependency/ antlr-2.7.7.jar javassist-3.18.1-GA.jar snakeyaml-1.16.jar spring-boot-starter-web-1.3.0.RELEASE.jar spring-webmvc-4.2.3.RELEASE.jar aopalliance-1.0.jar javax.transaction-api-1.2.jar spring-aop-4.2.3.RELEASE.jar spring-boot-starter-websocket-1.3.0.RELEASE.jar spring-websocket-4.2.3.RELEASE.jar aspectjweaver-1.8.7.jar jboss-logging-3.3.0.Final.jar spring-aspects-4.2.3.RELEASE.jar spring-context-4.2.3.RELEASE.jar thymeleaf-2.1.4.RELEASE.jar classmate-1.1.0.jar jboss-logging-annotations-1.2.0.Beta1.jar spring-beans-4.2.3.RELEASE.jar spring-core-4.2.3.RELEASE.jar thymeleaf-layout-dialect-1.3.1.jar dom4j-1.6.1.jar jcl-over-slf4j-1.7.13.jar spring-boot-1.3.0.RELEASE.jar spring-data-commons-1.11.1.RELEASE.jar thymeleaf-spring4-2.1.4.RELEASE.jar groovy-2.4.4.jar jstl-1.2.jar spring-boot-autoconfigure-1.3.0.RELEASE.jar spring-data-jpa-1.9.1.RELEASE.jar tomcat-embed-core-8.0.28.jar hibernate-commons-annotations-4.0.5.Final.jar jul-to-slf4j-1.7.13.jar spring-boot-starter-1.3.0.RELEASE.jar spring-expression-4.2.3.RELEASE.jar tomcat-embed-el-8.0.28.jar hibernate-core-4.3.11.Final.jar log4j-over-slf4j-1.7.13.jar spring-boot-starter-aop-1.3.0.RELEASE.jar spring-jdbc-4.2.3.RELEASE.jar tomcat-embed-logging-juli-8.0.28.jar hibernate-entitymanager-4.3.11.Final.jar logback-classic-1.1.3.jar spring-boot-starter-data-jpa-1.3.0.RELEASE.jar spring-messaging-4.2.3.RELEASE.jar tomcat-embed-websocket-8.0.28.jar hibernate-jpa-2.1-api-1.0.0.Final.jar logback-core-1.1.3.jar spring-boot-starter-jdbc-1.3.0.RELEASE.jar spring-orm-4.2.3.RELEASE.jar tomcat-jdbc-8.0.28.jar hibernate-validator-5.2.2.Final.jar mybatis-3.3.0.jar spring-boot-starter-logging-1.3.0.RELEASE.jar spring-security-config-4.0.3.RELEASE.jar tomcat-juli-8.0.28.jar jackson-annotations-2.6.3.jar mybatis-spring-1.2.3.jar spring-boot-starter-security-1.3.0.RELEASE.jar spring-security-core-4.0.3.RELEASE.jar unbescape-1.1.0.RELEASE.jar jackson-core-2.6.3.jar mysql-connector-java-5.1.37.jar spring-boot-starter-thymeleaf-1.3.0.RELEASE.jar spring-security-web-4.0.3.RELEASE.jar validation-api-1.1.0.Final.jar jackson-databind-2.6.3.jar ognl-3.0.8.jar spring-boot-starter-tomcat-1.3.0.RELEASE.jar spring-tx-4.2.3.RELEASE.jar xml-apis-1.0.b2.jar jandex-1.1.0.Final.jar slf4j-api-1.7.13.jar spring-boot-starter-validation-1.3.0.RELEASE.jar spring-web-4.2.3.RELEASE.jar
--encrypt-master-password
neo@MacBook-Pro ~ % mvn --encrypt-master-password test {LhCRW9y8CG4HfT7ExHI3msP56Cv+fgjdiNhTk883hZs=}
显示插件的详细信息
MacBook-Pro:deployment neo$ mvn help:describe -DgroupId=org.apache.maven.plugins -DartifactId=maven-war-plugin -Ddetail=true [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-help-plugin:2.2:describe (default-cli) @ standalone-pom --- [INFO] org.apache.maven.plugins:maven-war-plugin:3.1.0 Name: Apache Maven WAR Plugin Description: Builds a Web Application Archive (WAR) file from the project output and its dependencies. Group Id: org.apache.maven.plugins Artifact Id: maven-war-plugin Version: 3.1.0 Goal Prefix: war This plugin has 4 goals: war:exploded Description: Create an exploded webapp in a specified directory. Implementation: org.apache.maven.plugins.war.WarExplodedMojo Language: java Bound to phase: package Available parameters: archive The archive configuration to use. See Maven Archiver Reference. archiveClasses (Default: false) Whether a JAR file will be created for the classes in the webapp. Using this optional configuration parameter will make the compiled classes to be archived into a JAR file and the classes directory will then be excluded from the webapp. cacheFile (Default: ${project.build.directory}/war/work/webapp-cache.xml) Required: true The file containing the webapp structure cache. containerConfigXML The path to a configuration file for the servlet container. Note that the file name may be different for different servlet containers. Apache Tomcat uses a configuration file named context.xml. The file will be copied to the META-INF directory. delimiters Set of delimiters for expressions to filter within the resources. These delimiters are specified in the form 'beginToken*endToken'. If no '*' is given, the delimiter is assumed to be the same for start and end. So, the default filtering delimiters might be specified as: <delimiters> <delimiter>${*}</delimiter> <delimiter>@</delimiter> </delimiters> Since the '@' delimiter is the same on both ends, we don't need to specify '@*@' (though we can). dependentWarExcludes The comma separated list of tokens to exclude when doing a WAR overlay. Default is Overlay.DEFAULT_EXCLUDES dependentWarIncludes The comma separated list of tokens to include when doing a WAR overlay. Default is Overlay.DEFAULT_INCLUDES escapedBackslashesInFilePath (Default: false) To escape interpolated values with Windows path c:\foo\bar will be replaced with c:\\foo\\bar. escapeString Expression preceded with this String won't be interpolated. \${foo} will be replaced with ${foo}. filteringDeploymentDescriptors (Default: false) To filter deployment descriptors. Disabled by default. filters Filters (property files) to include during the interpolation of the pom.xml. includeEmptyDirectories (Default: false) (no description available) nonFilteredFileExtensions A list of file extensions that should not be filtered. Will be used when filtering webResources and overlays. outputFileNameMapping The file name mapping to use when copying libraries and TLDs. If no file mapping is set (default) the files are copied with their standard names. overlays The overlays to apply. Each <overlay> element may contain: - id (defaults to currentBuild) - groupId (if this and artifactId are null, then the current project is treated as its own overlay) - artifactId (see above) - classifier - type - includes (a list of string patterns) - excludes (a list of string patterns) - filtered (defaults to false) - skip (defaults to false) - targetPath (defaults to root of webapp structure) recompressZippedFiles (Default: true) Indicates if zip archives (jar,zip etc) being added to the war should be compressed again. Compressing again can result in smaller archive size, but gives noticeably longer execution time. resourceEncoding (Default: ${project.build.sourceEncoding}) The encoding to use when copying filtered web resources. supportMultiLineFiltering (Default: false) Stop searching endToken at the end of line useCache (Default: false) Whether the cache should be used to save the status of the webapp across multiple runs. Experimental feature so disabled by default. useDefaultDelimiters (Default: true) Use default delimiters in addition to custom delimiters, if any. useJvmChmod (Default: true) use jvmChmod rather that cli chmod and forking process warSourceDirectory (Default: ${basedir}/src/main/webapp) Required: true Single directory for extra files to include in the WAR. This is where you place your JSP files. warSourceExcludes The comma separated list of tokens to exclude when copying the content of the warSourceDirectory. warSourceIncludes (Default: **) The comma separated list of tokens to include when copying the content of the warSourceDirectory. webappDirectory (Default: ${project.build.directory}/${project.build.finalName}) Required: true The directory where the webapp is built. webResources The list of webResources we want to transfer. webXml The path to the web.xml file to use. workDirectory (Default: ${project.build.directory}/war/work) Required: true Directory to unpack dependent WARs into if needed. war:help Description: Display help information on maven-war-plugin. Call mvn war:help -Ddetail=true -Dgoal=<goal-name> to display parameter details. Implementation: org.apache.maven.plugins.war.HelpMojo Language: java Available parameters: detail (Default: false) User property: detail If true, display all settable properties for each goal. goal User property: goal The name of the goal for which to show help. If unspecified, all goals will be displayed. indentSize (Default: 2) User property: indentSize The number of spaces per indentation level, should be positive. lineLength (Default: 80) User property: lineLength The maximum length of a display line, should be positive. war:inplace Description: Generate the webapp in the WAR source directory. Implementation: org.apache.maven.plugins.war.WarInPlaceMojo Language: java Available parameters: archive The archive configuration to use. See Maven Archiver Reference. archiveClasses (Default: false) Whether a JAR file will be created for the classes in the webapp. Using this optional configuration parameter will make the compiled classes to be archived into a JAR file and the classes directory will then be excluded from the webapp. cacheFile (Default: ${project.build.directory}/war/work/webapp-cache.xml) Required: true The file containing the webapp structure cache. containerConfigXML The path to a configuration file for the servlet container. Note that the file name may be different for different servlet containers. Apache Tomcat uses a configuration file named context.xml. The file will be copied to the META-INF directory. delimiters Set of delimiters for expressions to filter within the resources. These delimiters are specified in the form 'beginToken*endToken'. If no '*' is given, the delimiter is assumed to be the same for start and end. So, the default filtering delimiters might be specified as: <delimiters> <delimiter>${*}</delimiter> <delimiter>@</delimiter> </delimiters> Since the '@' delimiter is the same on both ends, we don't need to specify '@*@' (though we can). dependentWarExcludes The comma separated list of tokens to exclude when doing a WAR overlay. Default is Overlay.DEFAULT_EXCLUDES dependentWarIncludes The comma separated list of tokens to include when doing a WAR overlay. Default is Overlay.DEFAULT_INCLUDES escapedBackslashesInFilePath (Default: false) To escape interpolated values with Windows path c:\foo\bar will be replaced with c:\\foo\\bar. escapeString Expression preceded with this String won't be interpolated. \${foo} will be replaced with ${foo}. filteringDeploymentDescriptors (Default: false) To filter deployment descriptors. Disabled by default. filters Filters (property files) to include during the interpolation of the pom.xml. includeEmptyDirectories (Default: false) (no description available) nonFilteredFileExtensions A list of file extensions that should not be filtered. Will be used when filtering webResources and overlays. outputFileNameMapping The file name mapping to use when copying libraries and TLDs. If no file mapping is set (default) the files are copied with their standard names. overlays The overlays to apply. Each <overlay> element may contain: - id (defaults to currentBuild) - groupId (if this and artifactId are null, then the current project is treated as its own overlay) - artifactId (see above) - classifier - type - includes (a list of string patterns) - excludes (a list of string patterns) - filtered (defaults to false) - skip (defaults to false) - targetPath (defaults to root of webapp structure) recompressZippedFiles (Default: true) Indicates if zip archives (jar,zip etc) being added to the war should be compressed again. Compressing again can result in smaller archive size, but gives noticeably longer execution time. resourceEncoding (Default: ${project.build.sourceEncoding}) The encoding to use when copying filtered web resources. supportMultiLineFiltering (Default: false) Stop searching endToken at the end of line useCache (Default: false) Whether the cache should be used to save the status of the webapp across multiple runs. Experimental feature so disabled by default. useDefaultDelimiters (Default: true) Use default delimiters in addition to custom delimiters, if any. useJvmChmod (Default: true) use jvmChmod rather that cli chmod and forking process warSourceDirectory (Default: ${basedir}/src/main/webapp) Required: true Single directory for extra files to include in the WAR. This is where you place your JSP files. warSourceExcludes The comma separated list of tokens to exclude when copying the content of the warSourceDirectory. warSourceIncludes (Default: **) The comma separated list of tokens to include when copying the content of the warSourceDirectory. webappDirectory (Default: ${project.build.directory}/${project.build.finalName}) Required: true The directory where the webapp is built. webResources The list of webResources we want to transfer. webXml The path to the web.xml file to use. workDirectory (Default: ${project.build.directory}/war/work) Required: true Directory to unpack dependent WARs into if needed. war:war Description: Build a WAR file. Implementation: org.apache.maven.plugins.war.WarMojo Language: java Bound to phase: package Available parameters: archive The archive configuration to use. See Maven Archiver Reference. archiveClasses (Default: false) Whether a JAR file will be created for the classes in the webapp. Using this optional configuration parameter will make the compiled classes to be archived into a JAR file and the classes directory will then be excluded from the webapp. attachClasses (Default: false) Whether classes (that is the content of the WEB-INF/classes directory) should be attached to the project as an additional artifact. By default the classifier for the additional artifact is 'classes'. You can change it with the someclassifier parameter. If this parameter true, another project can depend on the classes by writing something like: myGroup myArtifact myVersion classes cacheFile (Default: ${project.build.directory}/war/work/webapp-cache.xml) Required: true The file containing the webapp structure cache. classesClassifier (Default: classes) The classifier to use for the attached classes artifact. classifier Classifier to add to the generated WAR. If given, the artifact will be an attachment instead. The classifier will not be applied to the JAR file of the project - only to the WAR file. containerConfigXML The path to a configuration file for the servlet container. Note that the file name may be different for different servlet containers. Apache Tomcat uses a configuration file named context.xml. The file will be copied to the META-INF directory. delimiters Set of delimiters for expressions to filter within the resources. These delimiters are specified in the form 'beginToken*endToken'. If no '*' is given, the delimiter is assumed to be the same for start and end. So, the default filtering delimiters might be specified as: Since the '@' delimiter is the same on both ends, we don't need to specify '@*@' (though we can). dependentWarExcludes The comma separated list of tokens to exclude when doing a WAR overlay. Default is Overlay.DEFAULT_EXCLUDES dependentWarIncludes The comma separated list of tokens to include when doing a WAR overlay. Default is Overlay.DEFAULT_INCLUDES escapedBackslashesInFilePath (Default: false) To escape interpolated values with Windows path c:\foo\bar will be replaced with c:\\foo\\bar. escapeString Expression preceded with this String won't be interpolated. \${foo} will be replaced with ${foo}. failOnMissingWebXml Whether or not to fail the build if the web.xml file is missing. Set to false if you want your WAR built without a web.xml file. This may be useful if you are building an overlay that has no web.xml file. Starting with 3.1.0, this property defaults to false if the project depends on the Servlet 3.0 API or newer. filteringDeploymentDescriptors (Default: false) To filter deployment descriptors. Disabled by default. filters Filters (property files) to include during the interpolation of the pom.xml. includeEmptyDirectories (Default: false) (no description available) nonFilteredFileExtensions A list of file extensions that should not be filtered. Will be used when filtering webResources and overlays. outputDirectory (Default: ${project.build.directory}) Required: true The directory for the generated WAR. outputFileNameMapping The file name mapping to use when copying libraries and TLDs. If no file mapping is set (default) the files are copied with their standard names. overlays The overlays to apply. Each overlay element may contain: - id (defaults to currentBuild) - groupId (if this and artifactId are null, then the current project is treated as its own overlay) - artifactId (see above) - classifier - type - includes (a list of string patterns) - excludes (a list of string patterns) - filtered (defaults to false) - skip (defaults to false) - targetPath (defaults to root of webapp structure) packagingExcludes The comma separated list of tokens to exclude from the WAR before packaging. This option may be used to implement the skinny WAR use case. Note that you can use the Java Regular Expressions engine to include and exclude specific pattern using the expression %regex[]. Hint: read the about (?!Pattern). packagingIncludes The comma separated list of tokens to include in the WAR before packaging. By default everything is included. This option may be used to implement the skinny WAR use case. Note that you can use the Java Regular Expressions engine to include and exclude specific pattern using the expression %regex[]. primaryArtifact (Default: true) Whether this is the main artifact being built. Set to false if you don't want to install or deploy it to the local repository instead of the default one in an execution. recompressZippedFiles (Default: true) Indicates if zip archives (jar,zip etc) being added to the war should be compressed again. Compressing again can result in smaller archive size, but gives noticeably longer execution time. resourceEncoding (Default: ${project.build.sourceEncoding}) The encoding to use when copying filtered web resources. skip (Default: false) User property: maven.war.skip You can skip the execution of the plugin if you need to. Its use is NOT RECOMMENDED, but quite convenient on occasion. supportMultiLineFiltering (Default: false) Stop searching endToken at the end of line useCache (Default: false) Whether the cache should be used to save the status of the webapp across multiple runs. Experimental feature so disabled by default. useDefaultDelimiters (Default: true) Use default delimiters in addition to custom delimiters, if any. useJvmChmod (Default: true) use jvmChmod rather that cli chmod and forking process warSourceDirectory (Default: ${basedir}/src/main/webapp) Required: true Single directory for extra files to include in the WAR. This is where you place your JSP files. warSourceExcludes The comma separated list of tokens to exclude when copying the content of the warSourceDirectory. warSourceIncludes (Default: **) The comma separated list of tokens to include when copying the content of the warSourceDirectory. webappDirectory (Default: ${project.build.directory}/${project.build.finalName}) Required: true The directory where the webapp is built. webResources The list of webResources we want to transfer. webXml The path to the web.xml file to use. workDirectory (Default: ${project.build.directory}/war/work) Required: true Directory to unpack dependent WARs into if needed. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.960 s [INFO] Finished at: 2017-08-03T14:33:18+08:00 [INFO] Final Memory: 10M/155M [INFO] ------------------------------------------------------------------------
MacBook-Pro:api.netkiller.cn neo$ mvn help:describe \ -DgroupId=org.springframework.boot \ -DartifactId=spring-boot-maven-plugin \ -Ddetail=true