├── example-project-gradle ├── .idea │ ├── .name │ ├── vcs.xml │ ├── encodings.xml │ ├── compiler.xml │ ├── misc.xml │ ├── gradle.xml │ ├── jarRepositories.xml │ ├── codeStyles │ │ └── Project.xml │ └── markdown-navigator-enh.xml ├── settings.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── README.md ├── src │ ├── main │ │ └── resources │ │ │ ├── bindings.xjb │ │ │ ├── Example.xsd │ │ │ └── maven-4.0.0.xsd │ └── test │ │ └── groovy │ │ └── TestGeneratedMavenModel.groovy ├── build.gradle ├── gradlew.bat └── gradlew ├── src ├── main │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ └── com.sun.tools.xjc.Plugin │ └── java │ │ └── info │ │ └── hubbitus │ │ ├── annotation │ │ └── XsdInfo.java │ │ ├── JStringLiteralUnescaped.java │ │ └── XJCPluginDescriptionAnnotation.java └── test │ ├── resources │ └── Example.xsd │ └── groovy │ └── info │ └── hubbitus │ └── XJCPluginDescriptionAnnotationTest.groovy ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── vcs.xml ├── encodings.xml ├── compiler.xml ├── misc.xml ├── jarRepositories.xml ├── codeStyles │ └── Project.xml └── markdown-navigator-enh.xml ├── gradle.properties ├── .travis.yml ├── gradlew.bat ├── .gitignore ├── README.md └── gradlew /example-project-gradle/.idea/.name: -------------------------------------------------------------------------------- 1 | xjc-documentation-annotation-plugin-example-gradle -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin: -------------------------------------------------------------------------------- 1 | info.hubbitus.XJCPluginDescriptionAnnotation -------------------------------------------------------------------------------- /example-project-gradle/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'xjc-documentation-annotation-plugin-example-gradle' 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hubbitus/xjc-documentation-annotation-plugin/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example-project-gradle/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hubbitus/xjc-documentation-annotation-plugin/HEAD/example-project-gradle/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example-project-gradle/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example-project-gradle/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | versionJaxb = 2.4.0-b180830.0438 2 | versionJaxbIpi = 2.4.0-b180830.0359 3 | 4 | #versionGroovy = 3.0.0-alpha-4 5 | versionGroovy = 2.5.5 6 | versionSpock = 1.2-groovy-2.5 7 | 8 | versionSlf4j = 1.7.25 9 | versionLogback = 1.2.3 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example-project-gradle/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example-project-gradle/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jan 28 02:58:37 MSK 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # https://docs.travis-ci.com/user/languages/groovy/ 2 | language: groovy 3 | jdk: 4 | - openjdk11 5 | 6 | script: ./gradlew check --rerun-tasks 7 | 8 | before_cache: 9 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 10 | cache: 11 | directories: 12 | - $HOME/.gradle/caches/ 13 | - $HOME/.gradle/wrapper/ 14 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example-project-gradle/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example-project-gradle/README.md: -------------------------------------------------------------------------------- 1 | # xjc-documentation-annotation-plugin-example-gradle 2 | 3 | This is gradle demo project to show how to use Java code generation from XSD scheme with [xjc-documentation-annotation-plugin](https://github.com/Hubbitus/xjc-documentation-annotation-plugin). 4 | 5 | > **Please note** it is independent project, not gradle submodule of plugin! 6 | 7 | For run generation just invoke: 8 | 9 | ./gradlew xjcGenerate 10 | 11 | After compilation you will find generated classes in [src/main/generated-java](src/main/generated-java) 12 | 13 | Then you may with run tests: 14 | 15 | ./gradlew check 16 | -------------------------------------------------------------------------------- /example-project-gradle/src/main/resources/bindings.xjb: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /example-project-gradle/src/main/resources/Example.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Пользователь 7 | 8 | 9 | 10 | 11 | Фамилия и имя 12 | 13 | 14 | 15 | 16 | Возраст 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/test/resources/Example.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Пользователь 7 | 8 | 9 | 10 | 11 | Фамилия и имя 12 | 13 | 14 | 15 | 16 | Возраст 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /example-project-gradle/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /example-project-gradle/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 21 | 22 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example-project-gradle/.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 21 | 22 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/java/info/hubbitus/annotation/XsdInfo.java: -------------------------------------------------------------------------------- 1 | package info.hubbitus.annotation; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | /** 7 | * Annotation to handle XSD documentation annotations (russian names and element code). 8 | * 9 | * @author Pavel Alexeev. 10 | * @since 2019-01-18 14:03. 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface XsdInfo { 14 | /** 15 | * Russian name of class or field from 16 | *
17 | 	 *{@code
18 | 	 * 	
19 | 	 * 		Идентификатор
20 | 	 * 	
21 | 	 * }
22 | 	 * 
23 | * @return Class or field name 24 | */ 25 | String name(); 26 | 27 | /** 28 | * XSD XML element declaration as string. Like: 29 | *
30 | 	 * {@code
31 | 	 * 
32 | 	 *   
33 | 	 *     
34 | 	 *       
35 | 	 *         
36 | 	 *         
37 | 	 *         
38 | 	 *       
39 | 	 *     
40 | 	 *   
41 | 	 * 
42 | 	 * }
43 | 	 * 
44 | * @return XSD element representing class 45 | */ 46 | String xsdElementPart() default ""; 47 | } 48 | -------------------------------------------------------------------------------- /example-project-gradle/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'org.unbroken-dome.xjc' version '1.4.1' // https://github.com/unbroken-dome/gradle-xjc-plugin 4 | id 'idea' 5 | id 'groovy' // For Spock tests 6 | } 7 | 8 | group 'info.hubbitus' 9 | version '1.0-SNAPSHOT' 10 | 11 | sourceCompatibility = 1.8 12 | 13 | repositories { 14 | mavenCentral() 15 | } 16 | 17 | ext{ 18 | pluginVersion = '1.1' 19 | } 20 | 21 | dependencies { 22 | xjcClasspath "info.hubbitus:xjc-documentation-annotation-plugin:$pluginVersion" 23 | 24 | // Compile dependency for annotations used 25 | compile "info.hubbitus:xjc-documentation-annotation-plugin:$pluginVersion" 26 | testCompile "info.hubbitus:xjc-documentation-annotation-plugin:$pluginVersion" 27 | 28 | // Tests 29 | testCompile 'org.codehaus.groovy:groovy:2.5.5' 30 | testCompile 'org.spockframework:spock-core:1.2-groovy-2.5' 31 | } 32 | 33 | // Results will be in directory `src/main/generated-java` 34 | xjcGenerate { 35 | /** 36 | * There: 37 | * 1. Example.xsd is minimal example of functional. 38 | * 2. maven-4.0.0.xsd - example by SOq https://stackoverflow.com/questions/42223784/how-can-i-generate-a-class-from-which-i-can-retrieve-the-xml-of-a-node-as-a-stri 39 | */ 40 | source = fileTree('src/main/resources') { include '*.xsd' } 41 | bindingFiles = fileTree('src/main/jaxb') { include '*.xjb' } 42 | outputDirectory = file('src/main/generated-java') 43 | packageLevelAnnotations = false 44 | targetPackage = 'info.hubbitus.xjc.plugin.example' 45 | extraArgs = [ '-XPluginDescriptionAnnotation' ] 46 | } 47 | 48 | // Add generated files into compilation: 49 | // https://stackoverflow.com/questions/36749015/how-do-i-get-intellij-to-recognize-gradle-generated-sources-dir/44740130#44740130 50 | sourceSets.main.java.srcDir new File(buildDir, xjcGenerate.outputDirectory.absolutePath) 51 | idea { 52 | module { 53 | // Marks the already(!) added srcDir as "generated" 54 | generatedSourceDirs += xjcGenerate.outputDirectory 55 | } 56 | } 57 | 58 | compileTestGroovy.dependsOn xjcGenerate 59 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS="-Xmx64m" 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /example-project-gradle/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Java template 3 | # Compiled class file 4 | *.class 5 | 6 | # Log file 7 | *.log 8 | 9 | # BlueJ files 10 | *.ctxt 11 | 12 | # Mobile Tools for Java (J2ME) 13 | .mtj.tmp/ 14 | 15 | # Package Files # 16 | *.jar 17 | *.war 18 | *.nar 19 | *.ear 20 | *.zip 21 | *.tar.gz 22 | *.rar 23 | 24 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 25 | hs_err_pid* 26 | ### Gradle template 27 | .gradle 28 | /build/ 29 | /example-project-gradle/build 30 | 31 | # Ignore Gradle GUI config 32 | gradle-app.setting 33 | 34 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 35 | !gradle-wrapper.jar 36 | 37 | # Cache of project 38 | .gradletasknamecache 39 | 40 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 41 | # gradle/wrapper/gradle-wrapper.properties 42 | ### JetBrains template 43 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 44 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 45 | 46 | # User-specific stuff 47 | .idea/**/workspace.xml 48 | .idea/**/tasks.xml 49 | .idea/**/usage.statistics.xml 50 | .idea/**/dictionaries 51 | .idea/**/shelf 52 | .idea/**/markdown-navigator 53 | .idea/**/markdown-navigator.xml 54 | 55 | /example-project-gradle/.idea/**/workspace.xml 56 | /example-project-gradle/.idea/dbnavigator.xml 57 | /example-project-gradle/.idea/markdown-navigator.xml 58 | /example-project-gradle/.idea/markdown-navigator/ 59 | 60 | # Sensitive or high-churn files 61 | .idea/**/dataSources/ 62 | .idea/**/dataSources.ids 63 | .idea/**/dataSources.local.xml 64 | .idea/**/sqlDataSources.xml 65 | .idea/**/dynamic.xml 66 | .idea/**/uiDesigner.xml 67 | .idea/**/dbnavigator.xml 68 | 69 | # Gradle 70 | .idea/**/gradle.xml 71 | .idea/**/libraries 72 | 73 | # Gradle and Maven with auto-import 74 | # When using Gradle or Maven with auto-import, you should exclude module files, 75 | # since they will be recreated, and may cause churn. Uncomment if using 76 | # auto-import. 77 | .idea/modules.xml 78 | .idea/*.iml 79 | .idea/modules 80 | 81 | # CMake 82 | cmake-build-*/ 83 | 84 | # Mongo Explorer plugin 85 | .idea/**/mongoSettings.xml 86 | 87 | # File-based project format 88 | *.iws 89 | 90 | # IntelliJ 91 | out/ 92 | 93 | # mpeltonen/sbt-idea plugin 94 | .idea_modules/ 95 | 96 | # JIRA plugin 97 | atlassian-ide-plugin.xml 98 | 99 | # Cursive Clojure plugin 100 | .idea/replstate.xml 101 | 102 | # Crashlytics plugin (for Android Studio and IntelliJ) 103 | com_crashlytics_export_strings.xml 104 | crashlytics.properties 105 | crashlytics-build.properties 106 | fabric.properties 107 | 108 | # Editor-based Rest Client 109 | .idea/httpRequests 110 | -------------------------------------------------------------------------------- /src/main/java/info/hubbitus/JStringLiteralUnescaped.java: -------------------------------------------------------------------------------- 1 | package info.hubbitus; 2 | 3 | import com.sun.codemodel.JExpressionImpl; 4 | import com.sun.codemodel.JFormatter; 5 | 6 | /** 7 | * String literal unescaped. 8 | * Copied class {@link com.sun.codemodel.JStringLiteral} and slightly modified. 9 | * We can't just extend it because of non-public constructor 10 | * 11 | * @author Pavel Alexeev 12 | * @since 2019-01-24 01:26:29 13 | */ 14 | public class JStringLiteralUnescaped extends JExpressionImpl { 15 | 16 | public final String str; 17 | 18 | 19 | JStringLiteralUnescaped(String what) { 20 | this.str = what; 21 | 22 | } 23 | 24 | @Override 25 | public void generate(JFormatter f) { 26 | f.p(quotify('"', str)); 27 | } 28 | 29 | static final String charEscape = "\b\t\n\f\r\"\'\\"; 30 | static final String charMacro = "btnfr\"'\\"; 31 | /** 32 | * WARNING! Copy/past {@see com.sun.codemodel.JExpr#quotify(char, java.lang.String)} without Unicode characters escapes! 33 | * 34 | * Also {@see XJCPluginDescriptionAnnotation#annotateUnescaped(com.sun.codemodel.JAnnotatable, java.lang.Class, java.util.Map)} 35 | * 36 | * @bug @link https://github.com/javaee/jaxb-codemodel/issues/30 37 | * 38 | * Escapes the given string, then surrounds it by the specified 39 | * quotation mark. 40 | * @return String which proper quite literals, but not Unicode values 41 | */ 42 | private static String quotify(char quote, String s) { 43 | int n = s.length(); 44 | StringBuilder sb = new StringBuilder(n + 2); 45 | sb.append(quote); 46 | for (int i = 0; i < n; i++) { 47 | char c = s.charAt(i); 48 | int j = charEscape.indexOf(c); 49 | if(j>=0) { 50 | if((quote=='"' && c=='\'') || (quote=='\'' && c=='"')) { 51 | sb.append(c); 52 | } else { 53 | sb.append('\\'); 54 | sb.append(charMacro.charAt(j)); 55 | } 56 | } else { 57 | // // technically Unicode escape shouldn't be done here, 58 | // // for it's a lexical level handling. 59 | // // 60 | // // However, various tools are so broken around this area, 61 | // // so just to be on the safe side, it's better to do 62 | // // the escaping here (regardless of the actual file encoding) 63 | // // 64 | // // see bug 65 | // if( c<0x20 || 0x7EBy SO question "How can I generate a class from which I can retrieve the XML of a node as a String" 14 | */ 15 | def "Simple check present annotations on Plugin class"(){ 16 | when: 17 | Plugin plugin = new Plugin(); 18 | XsdInfo xsdAnnotation = plugin.getClass().getDeclaredAnnotation(XsdInfo.class); 19 | 20 | then: 'Introspect XSD fragment on class:' 21 | xsdAnnotation.name() == "The <plugin> element contains informations required for a plugin." 22 | xsdAnnotation.xsdElementPart() == ''' 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | ''' 79 | } 80 | } -------------------------------------------------------------------------------- /.idea/markdown-navigator-enh.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /example-project-gradle/.idea/markdown-navigator-enh.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/test/groovy/info/hubbitus/XJCPluginDescriptionAnnotationTest.groovy: -------------------------------------------------------------------------------- 1 | package info.hubbitus 2 | 3 | import com.sun.tools.xjc.Driver 4 | import com.sun.tools.xjc.XJCListener 5 | import groovy.util.logging.Slf4j 6 | import info.hubbitus.annotation.XsdInfo 7 | import org.xml.sax.SAXParseException 8 | import spock.lang.Specification 9 | 10 | import javax.tools.JavaCompiler 11 | import javax.tools.ToolProvider 12 | 13 | /** 14 | * @author Pavel Alexeev. 15 | * @since 2019-01-27 15:46. 16 | */ 17 | @Slf4j 18 | class XJCPluginDescriptionAnnotationTest extends Specification { 19 | def "check plugin present in help"(){ 20 | setup: 21 | // Catch output https://stackoverflow.com/questions/2169330/java-junit-capture-the-standard-input-output-for-use-in-a-unit-test/2169336#2169336 22 | ByteArrayOutputStream outStream = new ByteArrayOutputStream() 23 | System.setOut(new PrintStream(outStream)); 24 | 25 | ByteArrayOutputStream statusStream = new ByteArrayOutputStream() 26 | when: 27 | int res = Driver.run( 28 | ['-help'] as String[] 29 | ,new PrintStream(statusStream) 30 | ,new PrintStream(outStream) 31 | ) 32 | then: 33 | res == -1 34 | outStream.toString().contains("-XPluginDescriptionAnnotation : xjc plugin for bring XSD descriptions as annotations") 35 | } 36 | 37 | def "generate class, compile, load and check annotations"(){ 38 | setup: 39 | File generatedClassesDir = new File(this.getClass().getResource('/').getPath() + 'generated-classes') 40 | generatedClassesDir.mkdir() 41 | when: 42 | int res = Driver.run( 43 | [ 44 | '-npa' 45 | ,'-no-header' // To do not generate file headers (prolog comment) 46 | ,'-XPluginDescriptionAnnotation' 47 | ,'-d', generatedClassesDir.absolutePath 48 | ,'-p', 'info.hubbitus.generated.test' 49 | ,this.getClass().getResource('/Example.xsd') 50 | ] as String[] 51 | ,new XJCListener() { 52 | @Override 53 | void error(SAXParseException e) { 54 | log.error("SAX Parse exception: ", e) 55 | throw new IllegalStateException(e) 56 | } 57 | @Override 58 | void fatalError(SAXParseException e) { 59 | log.error("SAX Parse fatal exception: ", e) 60 | throw new IllegalStateException(e) 61 | } 62 | @Override 63 | void warning(SAXParseException e) { 64 | log.warn("SAX Parse warning: ", e) 65 | } 66 | @Override 67 | void info(SAXParseException e) { 68 | log.info("SAX Parse information: ", e) 69 | } 70 | @Override 71 | void generatedFile(String fileName, int current, int total) { 72 | log.debug("XJC generate new file [$fileName] $current from $total") 73 | super.generatedFile(fileName, current, total) 74 | } 75 | } 76 | ) 77 | then: 78 | res == 0 79 | 80 | when: // Compile generated class (by https://stackoverflow.com/questions/30912479/create-java-file-and-compile-it-to-a-class-file-at-runtime/33045582#33045582) 81 | JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); 82 | int compileRes = compiler.run(null, null, null, new File(generatedClassesDir, '/info/hubbitus/generated/test/Customer.java').absolutePath); 83 | then: 84 | compileRes == 0 85 | new File(generatedClassesDir, '/info/hubbitus/generated/test/Customer.class').exists() 86 | 87 | when: // Try load compiled class and instantiate object 88 | ClassLoader cl = new URLClassLoader([generatedClassesDir.toURI().toURL()] as URL[]) 89 | Class cls = cl.loadClass('info.hubbitus.generated.test.Customer') 90 | Object obj = cls.getDeclaredConstructor().newInstance() 91 | then: 92 | cls 93 | obj 94 | 95 | XsdInfo classAnnotation = cls.getDeclaredAnnotation(XsdInfo) 96 | classAnnotation.name() == 'Пользователь' 97 | classAnnotation.xsdElementPart() == ''' 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | ''' 108 | 109 | cls.getDeclaredFields().size() == 3 110 | cls.getDeclaredFields().find{ 'name' == it.name }.getAnnotation(XsdInfo).name() == 'Фамилия и имя' 111 | cls.getDeclaredFields().find{ 'age' == it.name }.getAnnotation(XsdInfo).name() == 'Возраст' 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Autobuild Status](https://travis-ci.org/Hubbitus/xjc-documentation-annotation-plugin.svg?branch=master)](https://travis-ci.org/Hubbitus/xjc-documentation-annotation-plugin) 2 | 3 | XJC plugin to bring XSD descriptions into annotations of generated classes 4 | ========================================================================== 5 | 6 | [Habr article](https://habr.com/en/post/437914/) (in Russian) describing for what it and how to use. 7 | 8 | 9 | Why that plugin born you may find at the end of readme, but now lets look what it does and how to use it! 10 | 11 | ## What it does: \\ -> Java class annotations 12 | 13 | Said we have this object described in XSD: 14 | 15 | ```xml 16 | 17 | 18 | Пользователь 19 | 20 | 21 | 22 | 23 | Фамилия и имя 24 | 25 | 26 | 27 | 28 | ``` 29 | 30 | We run xjc like: 31 | 32 | xjc -npa -no-header -d src/main/generated-java/ -p xsd.generated scheme.xsd 33 | 34 | And got class like (getters, setters and any annotations omitted for simplicity): 35 | 36 | ```java 37 | public class Customer { 38 | @XmlElement(required = true) 39 | protected String name; 40 | } 41 | ``` 42 | 43 | **But in my case I want known how to class and fields was named in source file!** 44 | So it what this plugin do! 45 | 46 | So you get: 47 | 48 | ```java 49 | @XsdInfo(name = "Пользователь", xsdElementPart = "\n \n \n \n \n \n \n \n") 50 | public class Customer { 51 | 52 | @XmlElement(required = true) 53 | @XsdInfo(name = "Фамилия и имя") 54 | protected String name; 55 | } 56 | ``` 57 | 58 | ## How to use 59 | 60 | ### Manual call in commandline 61 | If you want run it manually ensure jar class with plugin in run classpath and just add option `-XPluginDescriptionAnnotation`. F.e.: 62 | 63 | xjc -npa -no-header -d src/main/generated-java/ -p xsd.generated -XPluginDescriptionAnnotation scheme.xsd 64 | 65 | ### Call from Java/Groovy 66 | ```groovy 67 | Driver.run( 68 | [ 69 | '-XPluginDescriptionAnnotation' 70 | ,'-d', generatedClassesDir.absolutePath 71 | ,'-p', 'info.hubbitus.generated.test' 72 | ,'Example.xsd' 73 | ] as String[] 74 | ,new XJCListener() {...} 75 | ) 76 | ``` 77 | 78 | See test [XJCPluginDescriptionAnnotationTest](src/test/groovy/info/hubbitus/XJCPluginDescriptionAnnotationTest.groovy) for example. 79 | 80 | ### Use from Gradle 81 | 82 | With [gradle-xjc-plugin](https://github.com/unbroken-dome/gradle-xjc-plugin): 83 | 84 | ```gradle 85 | plugins { 86 | id 'java' 87 | id 'org.unbroken-dome.xjc' version '1.4.1' // https://github.com/unbroken-dome/gradle-xjc-plugin 88 | } 89 | 90 | ... 91 | 92 | dependencies { 93 | xjcClasspath 'info.hubbitus:xjc-documentation-annotation-plugin:1.0' 94 | } 95 | 96 | // Results by default in `build/xjc/generated-sources` 97 | xjcGenerate { 98 | source = fileTree('src/main/resources') { include '*.xsd' } 99 | packageLevelAnnotations = false 100 | targetPackage = 'info.hubbitus.xjc.plugin.example' 101 | extraArgs = [ '-XPluginDescriptionAnnotation' ] 102 | } 103 | ``` 104 | Just run: 105 | 106 | ./gradlew xjcGenerate 107 | 108 | Please look complete example in [example-project-gradle](example-project-gradle) directory - it have fully independent gradle project ot demonstrate how to use this plugin.. 109 | 110 | ## Development: 111 | 112 | Build: 113 | 114 | ./gradlew jar 115 | 116 | Run tests: 117 | 118 | ./gradlew test 119 | 120 | ## Rationale (why it is born) 121 | For our integration we have task load big amount of `XSD` files into `MDM` software (proprietary [Unidata](https://unidata-platform.com/)). 122 | 123 | `XJC` is good tool for generate Java `DTO` classes from `XSD` specification. It was first part ow way. 124 | Then I got excellent [reflections](https://github.com/ronmamo/reflections) library and travers generated classes. 125 | 126 | Problem was I was not be able name my model items with original annotations! Despite `XJC` place initial Javadoc which contains description and related part of `XML` element it have several problems: 127 | 128 | 1. That only for class, and absent fo fields. 129 | 2. Even for class I can't use javadoc in runtime 130 | 131 | First approach to parse `XSD` for documentation on groovy works, but was very fragile and always require get updates and hacks. 132 | 133 | I long time search way to bring such annotations into `DTO` classes itself to do not do work twice (generate classes and again parse `XSD` files manually). 134 | I did not found solution. And it is the reason born of that plugin. 135 | 136 | ## Licensed under MIT 137 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS='"-Xmx64m"' 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /example-project-gradle/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /src/main/java/info/hubbitus/XJCPluginDescriptionAnnotation.java: -------------------------------------------------------------------------------- 1 | package info.hubbitus; 2 | 3 | import java.io.IOException; 4 | import java.io.StringWriter; 5 | import java.lang.annotation.Annotation; 6 | import java.lang.reflect.Field; 7 | import java.util.LinkedHashMap; 8 | import java.util.Map; 9 | 10 | import com.sun.codemodel.JAnnotatable; 11 | import com.sun.codemodel.JAnnotationUse; 12 | import com.sun.codemodel.JExpression; 13 | import com.sun.codemodel.JFieldVar; 14 | import com.sun.codemodel.util.JavadocEscapeWriter; 15 | import com.sun.tools.xjc.Options; 16 | import com.sun.tools.xjc.Plugin; 17 | import com.sun.tools.xjc.model.CClassInfo; 18 | import com.sun.tools.xjc.model.CPropertyInfo; 19 | import com.sun.tools.xjc.outline.ClassOutline; 20 | import com.sun.tools.xjc.outline.Outline; 21 | import com.sun.tools.xjc.reader.xmlschema.bindinfo.BindInfo; 22 | import com.sun.xml.xsom.XSComponent; 23 | import com.sun.xml.xsom.impl.AttributeUseImpl; 24 | import com.sun.xml.xsom.impl.ParticleImpl; 25 | import com.sun.xml.xsom.impl.util.SchemaWriter; 26 | import info.hubbitus.annotation.XsdInfo; 27 | import org.xml.sax.ErrorHandler; 28 | 29 | 30 | /** 31 | * XJC plugin to place XSD documentation annotations ({@code }) for runtime usage on classes and fields. 32 | * 33 | * F.e. for XSD declaration: 34 | * 35 | *
{@code
 36 |  * 	
 37 |  * 		
 38 |  * 			Пользователь
 39 |  * 		
 40 |  * 		
 41 |  * 			
 42 |  * 				
 43 |  * 					Фамилия и имя
 44 |  * 				
 45 |  * 			
 46 |  * 			
 47 |  * 				
 48 |  * 					Возраст
 49 |  * 				
 50 |  * 			
 51 |  * 		
 52 |  * 	
 53 |  * }
54 | * Will be generated (stripped, base annotations and methods omitted): 55 | *
{@code
 56 |  * \@XsdInfo(name = "Пользователь", xsdElementPart = "\n  \n    \n      \n        \n        \n      \n    \n  \n")
 57 |  * public class Customer {
 58 |  *
 59 |  *     \@XmlElement(required = true)
 60 |  *     \@XsdInfo(name = "Фамилия и имя")
 61 |  *     protected String name;
 62 |  *     \@XmlElement(required = true)
 63 |  *     \@XmlSchemaType(name = "positiveInteger")
 64 |  *     \@XsdInfo(name = "Возраст")
 65 |  *     protected BigInteger age;
 66 |  * \}
 67 |  * }
68 | * 69 | * 70 | * @see How to Implement Your Own XJC Plugin to Generate toString(), equals(), and hashCode() Methods 71 | * @see Creating an XJC plugin 72 | * @see SOq xjc java classes generation, where fields have the same name as @XmlElement 73 | * @see JAXB convert non-ASCII characters to ASCII characters 74 | * 75 | * @see Reusing generated jaxb classes 76 | * 77 | * @author Pavel Alexeev. 78 | * @since 2019-01-17 03:34. 79 | */ 80 | public class XJCPluginDescriptionAnnotation extends Plugin { 81 | @Override 82 | public String getOptionName() { 83 | return "XPluginDescriptionAnnotation"; 84 | } 85 | 86 | @Override 87 | public int parseArgument(Options opt, String[] args, int i) { 88 | return 0; 89 | } 90 | 91 | @Override 92 | public String getUsage() { 93 | return " -XPluginDescriptionAnnotation : xjc plugin for bring XSD descriptions as annotations"; 94 | } 95 | 96 | @Override 97 | public boolean run(Outline model, Options opt, ErrorHandler errorHandler) { 98 | model.getClasses().forEach( 99 | (ClassOutline c)-> { 100 | CClassInfo classInfo = c.target; 101 | annotateUnescaped( 102 | c.implClass 103 | ,XsdInfo.class 104 | ,new LinkedHashMap(){{ 105 | put("name", classInfoGetDescriptionAnnotation(classInfo)); 106 | put("xsdElementPart", getXsdXmlDeclaration(classInfo.getSchemaComponent())); 107 | }} 108 | ); 109 | 110 | c.implClass.fields().forEach((String name, JFieldVar jField) -> { 111 | CPropertyInfo property = classInfo.getProperties().stream() 112 | .filter(it-> it.getName(false).equals(jField.name())) 113 | .findAny() 114 | .orElseThrow(()-> new IllegalStateException("Can't find property [" + jField.name() + "] in class [" + classInfo.getTypeName() + "]")); 115 | 116 | annotateUnescaped(jField, XsdInfo.class, new LinkedHashMap(){{put("name", fieldGetDescriptionAnnotation(property));}}); 117 | }); 118 | } 119 | ); 120 | 121 | return true; 122 | } 123 | 124 | /** 125 | * Workaround method! 126 | * By default annotation russian values escaped like '\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u044f' instead of "Заголовок заявления". 127 | * It happened in: {@see com.sun.codemodel.JExpr#quotify(char, java.lang.String)} (call from {@see com.sun.codemodel.JStringLiteralUnescaped#generate(com.sun.codemodel.JFormatter)}). So it is hardcoded in XJC. We search graceful way to override it. 128 | * We want it be unescaped. 129 | * See upstream bug 130 | * 131 | * So, instead of just do: 132 | * 133 | * jField.annotate(XsdInfo.class).param("name", "Русское описание"); 134 | * 135 | * You may do instead: 136 | * 137 | * annotate(jField, XsdInfo.class, Map.Of("name", "Русское описание")) 138 | * 139 | */ 140 | @SuppressWarnings("unchecked") 141 | private static void annotateUnescaped(JAnnotatable object, Class annotation, Map parameters){ 142 | assert parameters.size() > 0; 143 | 144 | JAnnotationUse ann = object.annotate(annotation); 145 | final Map m; // Lambda requires final variable 146 | 147 | // {@see com.sun.codemodel.JAnnotationUse.memberValues} 148 | Map m1 = (Map)getPrivateField(ann, "memberValues"); 149 | if (null == m1){ 150 | ann.param(parameters.keySet().iterator().next(), "");// Just init memberValues private map, such key will be replaced 151 | m = (Map)getPrivateField(ann, "memberValues"); 152 | } 153 | else{ 154 | m = m1; 155 | } 156 | assert m.size() > 0; 157 | parameters.forEach((key, val) -> { 158 | m.put(key, new JStringLiteralUnescaped(val)); 159 | }); 160 | } 161 | 162 | private static Object getPrivateField(Object obj, String fieldName) { 163 | try { 164 | Field f = obj.getClass().getDeclaredField(fieldName); 165 | f.setAccessible(true); 166 | return f.get(obj); 167 | } catch (NoSuchFieldException | IllegalAccessException e) { 168 | throw new IllegalStateException("Can't get field [" + fieldName + "] from object [" + obj + "]!", e); 169 | } 170 | } 171 | 172 | static private String classInfoGetDescriptionAnnotation(CClassInfo classInfo){ 173 | String description = ""; 174 | if (null != (classInfo.getSchemaComponent()).getAnnotation()){ 175 | description = ((BindInfo)(classInfo.getSchemaComponent()).getAnnotation().getAnnotation()).getDocumentation(); 176 | } 177 | return description.trim(); 178 | } 179 | 180 | static private String fieldGetDescriptionAnnotation(CPropertyInfo propertyInfo){ 181 | String description = ""; 182 | assert ( (propertyInfo.getSchemaComponent() instanceof AttributeUseImpl) || (propertyInfo.getSchemaComponent() instanceof ParticleImpl) ); 183 | // 184 | // 185 | // 186 | // Идентификатор документа 187 | if ( (propertyInfo.getSchemaComponent() instanceof AttributeUseImpl) 188 | && null != ( ((AttributeUseImpl)propertyInfo.getSchemaComponent()).getDecl().getAnnotation() )){ 189 | description = ((BindInfo)((AttributeUseImpl)propertyInfo.getSchemaComponent()).getDecl().getAnnotation().getAnnotation()).getDocumentation(); 190 | } 191 | // 192 | // 193 | // 194 | // Заголовок заявления 195 | if ( (propertyInfo.getSchemaComponent() instanceof ParticleImpl) 196 | && null != ( (((ParticleImpl) propertyInfo.getSchemaComponent()).getTerm()).getAnnotation() )){ 197 | description = ((BindInfo)(((ParticleImpl) propertyInfo.getSchemaComponent()).getTerm()).getAnnotation().getAnnotation()).getDocumentation(); 198 | } 199 | return description.trim(); 200 | } 201 | 202 | // @Override 203 | // public void postProcessModel(Model model, ErrorHandler errorHandler) { 204 | // super.postProcessModel(model, errorHandler); 205 | // } 206 | 207 | /** 208 | * See implementation in {@see ClassSelector#addSchemaFragmentJavadoc(CClassInfo, XSComponent)} 209 | */ 210 | static private String getXsdXmlDeclaration(XSComponent sc){ 211 | StringWriter out = new StringWriter(); 212 | SchemaWriter sw = new SchemaWriter(new JavadocEscapeWriter(out){ 213 | @Override 214 | public void write(int ch) throws IOException { 215 | out.write(ch); 216 | } 217 | }); 218 | sc.visit(sw); 219 | return out.toString().trim(); 220 | } 221 | 222 | } 223 | -------------------------------------------------------------------------------- /example-project-gradle/src/main/resources/maven-4.0.0.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 3.0.0+ 10 | 11 | 12 | The <code>&lt;project&gt;</code> element is the root of the descriptor. 13 | The following table lists all of the possible child elements. 14 | 15 | 16 | 17 | 18 | 19 | 20 | 3.0.0+ 21 | 22 | 23 | The <code>&lt;project&gt;</code> element is the root of the descriptor. 24 | The following table lists all of the possible child elements. 25 | 26 | 27 | 28 | 29 | 30 | 31 | 4.0.0+ 32 | Declares to which version of project descriptor this POM conforms. 33 | 34 | 35 | 36 | 37 | 4.0.0+ 38 | The location of the parent project, if one exists. Values from the parent 39 | project will be the default for this project if they are left unspecified. The location 40 | is given as a group ID, artifact ID and version. 41 | 42 | 43 | 44 | 45 | 3.0.0+ 46 | 47 | 48 | A universally unique identifier for a project. It is normal to 49 | use a fully-qualified package name to distinguish it from other 50 | projects with a similar name (eg. <code>org.apache.maven</code>). 51 | 52 | 53 | 54 | 55 | 56 | 57 | 3.0.0+ 58 | The identifier for this artifact that is unique within the group given by the 59 | group ID. An artifact is something that is either produced or used by a project. 60 | Examples of artifacts produced by Maven for a project include: JARs, source and binary 61 | distributions, and WARs. 62 | 63 | 64 | 65 | 66 | 4.0.0+ 67 | The current version of the artifact produced by this project. 68 | 69 | 70 | 71 | 72 | 4.0.0+ 73 | 74 | 75 | The type of artifact this project produces, for example <code>jar</code> 76 | <code>war</code> 77 | <code>ear</code> 78 | <code>pom</code>. 79 | Plugins can create their own packaging, and 80 | therefore their own packaging types, 81 | so this list does not contain all possible types. 82 | 83 | 84 | 85 | 86 | 87 | 88 | 3.0.0+ 89 | The full name of the project. 90 | 91 | 92 | 93 | 94 | 3.0.0+ 95 | A detailed description of the project, used by Maven whenever it needs to 96 | describe the project, such as on the web site. While this element can be specified as 97 | CDATA to enable the use of HTML tags within the description, it is discouraged to allow 98 | plain text representation. If you need to modify the index page of the generated web 99 | site, you are able to specify your own instead of adjusting this text. 100 | 101 | 102 | 103 | 104 | 3.0.0+ 105 | 106 | 107 | The URL to the project's homepage. 108 | <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId 109 | 110 | 111 | 112 | 113 | 114 | 115 | 3.0.0+ 116 | The year of the project's inception, specified with 4 digits. This value is 117 | used when generating copyright notices as well as being informational. 118 | 119 | 120 | 121 | 122 | 3.0.0+ 123 | This element describes various attributes of the organization to which the 124 | project belongs. These attributes are utilized when documentation is created (for 125 | copyright notices and links). 126 | 127 | 128 | 129 | 130 | 3.0.0+ 131 | 132 | 133 | This element describes all of the licenses for this project. 134 | Each license is described by a <code>license</code> element, which 135 | is then described by additional elements. 136 | Projects should only list the license(s) that applies to the project 137 | and not the licenses that apply to dependencies. 138 | If multiple licenses are listed, it is assumed that the user can select 139 | any of them, not that they must accept all. 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 3.0.0+ 152 | Describes the committers of a project. 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 3.0.0+ 163 | Describes the contributors to a project that are not yet committers. 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 3.0.0+ 174 | Contains information about a project's mailing lists. 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 4.0.0+ 185 | Describes the prerequisites in the build environment for this project. 186 | 187 | 188 | 189 | 190 | 4.0.0+ 191 | The modules (sometimes called subprojects) to build as a part of this 192 | project. Each module listed is a relative path to the directory containing the module. 193 | To be consistent with the way default urls are calculated from parent, it is recommended 194 | to have module names match artifact ids. 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 4.0.0+ 205 | Specification for the SCM used by the project, such as CVS, Subversion, etc. 206 | 207 | 208 | 209 | 210 | 4.0.0+ 211 | The project's issue management system information. 212 | 213 | 214 | 215 | 216 | 4.0.0+ 217 | The project's continuous integration information. 218 | 219 | 220 | 221 | 222 | 4.0.0+ 223 | Distribution information for a project that enables deployment of the site 224 | and artifacts to remote web servers and repositories respectively. 225 | 226 | 227 | 228 | 229 | 4.0.0+ 230 | 231 | 232 | Properties that can be used throughout the POM as a substitution, and 233 | are used as filters in resources if enabled. 234 | The format is <code>&lt;name&gt;value&lt;/name&gt;</code>. 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 4.0.0+ 247 | Default dependency information for projects that inherit from this one. The 248 | dependencies in this section are not immediately resolved. Instead, when a POM derived 249 | from this one declares a dependency described by a matching groupId and artifactId, the 250 | version and other values from this section are used for that dependency if they were not 251 | already specified. 252 | 253 | 254 | 255 | 256 | 3.0.0+ 257 | 258 | 259 | This element describes all of the dependencies associated with a 260 | project. 261 | These dependencies are used to construct a classpath for your 262 | project during the build process. They are automatically downloaded from the 263 | repositories defined in this project. 264 | See <a href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">the 265 | dependency mechanism</a> for more information. 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 4.0.0+ 278 | The lists of the remote repositories for discovering dependencies and 279 | extensions. 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 4.0.0+ 290 | The lists of the remote repositories for discovering plugins for builds and 291 | reports. 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 3.0.0+ 302 | Information required to build the project. 303 | 304 | 305 | 306 | 307 | 4.0.0+ 308 | 309 | 310 | <b>Deprecated</b>. Now ignored by Maven. 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 4.0.0+ 323 | 324 | 325 | This element includes the specification of report plugins to use 326 | to generate the reports on the Maven-generated site. 327 | These reports will be run when a user executes <code>mvn site</code>. 328 | All of the reports will be included in the navigation bar for browsing. 329 | 330 | 331 | 332 | 333 | 334 | 335 | 4.0.0+ 336 | A listing of project-local build profiles which will modify the build process 337 | when activated. 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 4.0.0+ 350 | 351 | 352 | The <code>&lt;parent&gt;</code> element contains information required to locate the parent project from which 353 | this project will inherit from. 354 | <strong>Note:</strong> The children of this element are not interpolated and must be given as literal values. 355 | 356 | 357 | 358 | 359 | 360 | 361 | 4.0.0+ 362 | The group id of the parent project to inherit from. 363 | 364 | 365 | 366 | 367 | 4.0.0+ 368 | The artifact id of the parent project to inherit from. 369 | 370 | 371 | 372 | 373 | 4.0.0+ 374 | The version of the parent project to inherit. 375 | 376 | 377 | 378 | 379 | 4.0.0+ 380 | 381 | 382 | The relative path of the parent <code>pom.xml</code> file within the check out. 383 | If not specified, it defaults to <code>../pom.xml</code>. 384 | Maven looks for the parent POM first in this location on 385 | the filesystem, then the local repository, and lastly in the remote repo. 386 | <code>relativePath</code> allows you to select a different location, 387 | for example when your structure is flat, or deeper without an intermediate parent POM. 388 | However, the group ID, artifact ID and version are still required, 389 | and must match the file in the location given or it will revert to the repository for the POM. 390 | This feature is only for enhancing the development in a local checkout of that project. 391 | Set the value to an empty string in case you want to disable the feature and always resolve 392 | the parent POM from the repositories. 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 3.0.0+ 402 | Specifies the organization that produces this project. 403 | 404 | 405 | 406 | 407 | 3.0.0+ 408 | The full name of the organization. 409 | 410 | 411 | 412 | 413 | 3.0.0+ 414 | The URL to the organization's home page. 415 | 416 | 417 | 418 | 419 | 420 | 421 | 4.0.0+ 422 | This elements describes all that pertains to distribution for a project. It is 423 | primarily used for deployment of artifacts and the site produced by the build. 424 | 425 | 426 | 427 | 428 | 4.0.0+ 429 | Information needed to deploy the artifacts generated by the project to a 430 | remote repository. 431 | 432 | 433 | 434 | 435 | 4.0.0+ 436 | 437 | 438 | Where to deploy snapshots of artifacts to. If not given, it defaults to the 439 | <code>repository</code> element. 440 | 441 | 442 | 443 | 444 | 445 | 446 | 4.0.0+ 447 | Information needed for deploying the web site of the project. 448 | 449 | 450 | 451 | 452 | 4.0.0+ 453 | 454 | 455 | The URL of the project's download page. If not given users will be 456 | referred to the homepage given by <code>url</code>. 457 | This is given to assist in locating artifacts that are not in the repository due to 458 | licensing restrictions. 459 | 460 | 461 | 462 | 463 | 464 | 465 | 4.0.0+ 466 | Relocation information of the artifact if it has been moved to a new group ID 467 | and/or artifact ID. 468 | 469 | 470 | 471 | 472 | 4.0.0+ 473 | 474 | 475 | Gives the status of this artifact in the remote repository. 476 | This must not be set in your local project, as it is updated by 477 | tools placing it in the reposiory. Valid values are: <code>none</code> (default), 478 | <code>converted</code> (repository manager converted this from an Maven 1 POM), 479 | <code>partner</code> 480 | (directly synced from a partner Maven 2 repository), <code>deployed</code> (was deployed from a Maven 2 481 | instance), <code>verified</code> (has been hand verified as correct and final). 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 4.0.0+ 491 | Describes where an artifact has moved to. If any of the values are omitted, it is 492 | assumed to be the same as it was before. 493 | 494 | 495 | 496 | 497 | 4.0.0+ 498 | The group ID the artifact has moved to. 499 | 500 | 501 | 502 | 503 | 4.0.0+ 504 | The new artifact ID of the artifact. 505 | 506 | 507 | 508 | 509 | 4.0.0+ 510 | The new version of the artifact. 511 | 512 | 513 | 514 | 515 | 4.0.0+ 516 | An additional message to show the user about the move, such as the reason. 517 | 518 | 519 | 520 | 521 | 522 | 523 | 4.0.0+ 524 | Contains the information needed for deploying websites. 525 | 526 | 527 | 528 | 529 | 4.0.0+ 530 | 531 | 532 | A unique identifier for a deployment location. This is used to match the 533 | site to configuration in the <code>settings.xml</code> file, for example. 534 | 535 | 536 | 537 | 538 | 539 | 540 | 4.0.0+ 541 | Human readable name of the deployment location. 542 | 543 | 544 | 545 | 546 | 4.0.0+ 547 | 548 | 549 | The url of the location where website is deployed, in the form <code>protocol://hostname/path</code>. 550 | <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 4.0.0+ 560 | Repository contains the information needed for deploying to the remote 561 | repository. 562 | 563 | 564 | 565 | 566 | 4.0.0+ 567 | Whether to assign snapshots a unique version comprised of the timestamp and 568 | build number, or to use the same version each time 569 | 570 | 571 | 572 | 573 | 4.0.0+ 574 | How to handle downloading of releases from this repository. 575 | 576 | 577 | 578 | 579 | 4.0.0+ 580 | How to handle downloading of snapshots from this repository. 581 | 582 | 583 | 584 | 585 | 4.0.0+ 586 | 587 | 588 | A unique identifier for a repository. This is used to match the repository 589 | to configuration in the <code>settings.xml</code> file, for example. Furthermore, the identifier is 590 | used during POM inheritance and profile injection to detect repositories that should be merged. 591 | 592 | 593 | 594 | 595 | 596 | 597 | 4.0.0+ 598 | Human readable name of the repository. 599 | 600 | 601 | 602 | 603 | 4.0.0+ 604 | 605 | 606 | The url of the repository, in the form <code>protocol://hostname/path</code>. 607 | 608 | 609 | 610 | 611 | 612 | 613 | 4.0.0+ 614 | 615 | 616 | The type of layout this repository uses for locating and storing artifacts - 617 | can be <code>legacy</code> or <code>default</code>. 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 4.0.0+ 627 | Download policy. 628 | 629 | 630 | 631 | 632 | 4.0.0+ 633 | 634 | 635 | Whether to use this repository for downloading this type of artifact. Note: While the type 636 | of this field is <code>String</code> for technical reasons, the semantic type is actually 637 | <code>Boolean</code>. Default value is <code>true</code>. 638 | 639 | 640 | 641 | 642 | 643 | 644 | 4.0.0+ 645 | 646 | 647 | The frequency for downloading updates - can be 648 | <code>always,</code> 649 | <code>daily</code> 650 | (default), 651 | <code>interval:XXX</code> 652 | (in minutes) or 653 | <code>never</code> 654 | (only if it doesn't exist locally). 655 | 656 | 657 | 658 | 659 | 660 | 661 | 4.0.0+ 662 | 663 | 664 | What to do when verification of an artifact checksum fails. Valid values are 665 | <code>ignore</code> 666 | , 667 | <code>fail</code> 668 | or 669 | <code>warn</code> 670 | (the default). 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 4.0.0+ 680 | Describes the prerequisites a project can have. 681 | 682 | 683 | 684 | 685 | 4.0.0+ 686 | 687 | For a plugin project, the minimum version of Maven required to use 688 | the resulting plugin.<br /> 689 | For specifying the minimum version of Maven required to build a 690 | project, this element is <b>deprecated</b>. Use the Maven Enforcer 691 | Plugin's <a href="https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html"><code>requireMavenVersion</code></a> 692 | rule instead. 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 3.0.0+ 702 | Description of a person who has contributed to the project, but who does not have 703 | commit privileges. Usually, these contributions come in the form of patches submitted. 704 | 705 | 706 | 707 | 708 | 3.0.0+ 709 | The full name of the contributor. 710 | 711 | 712 | 713 | 714 | 3.0.0+ 715 | The email address of the contributor. 716 | 717 | 718 | 719 | 720 | 3.0.0+ 721 | The URL for the homepage of the contributor. 722 | 723 | 724 | 725 | 726 | 3.0.0+ 727 | The organization to which the contributor belongs. 728 | 729 | 730 | 731 | 732 | 3.0.0+ 733 | The URL of the organization. 734 | 735 | 736 | 737 | 738 | 3.0.0+ 739 | 740 | 741 | The roles the contributor plays in the project. Each role is described by a 742 | <code>role</code> element, the body of which is a role name. This can also be used to 743 | describe the contribution. 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 3.0.0+ 756 | 757 | 758 | The timezone the contributor is in. Typically, this is a number in the range 759 | <a href="http://en.wikipedia.org/wiki/UTC%E2%88%9212:00">-12</a> to <a href="http://en.wikipedia.org/wiki/UTC%2B14:00">+14</a> 760 | or a valid time zone id like "America/Montreal" (UTC-05:00) or "Europe/Paris" (UTC+01:00). 761 | 762 | 763 | 764 | 765 | 766 | 767 | 3.0.0+ 768 | Properties about the contributor, such as an instant messenger handle. 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 4.0.0+ 781 | 782 | 783 | The <code>&lt;scm&gt;</code> element contains informations required to the SCM 784 | (Source Control Management) of the project. 785 | 786 | 787 | 788 | 789 | 790 | 791 | 4.0.0+ 792 | 793 | 794 | The source control management system URL 795 | that describes the repository and how to connect to the 796 | repository. For more information, see the 797 | <a href="http://maven.apache.org/scm/scm-url-format.html">URL format</a> 798 | and <a href="http://maven.apache.org/scm/scms-overview.html">list of supported SCMs</a>. 799 | This connection is read-only. 800 | <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId 801 | 802 | 803 | 804 | 805 | 806 | 807 | 4.0.0+ 808 | 809 | 810 | Just like <code>connection</code>, but for developers, i.e. this scm connection 811 | will not be read only. 812 | <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId 813 | 814 | 815 | 816 | 817 | 818 | 819 | 4.0.0+ 820 | The tag of current code. By default, it's set to HEAD during development. 821 | 822 | 823 | 824 | 825 | 4.0.0+ 826 | 827 | 828 | The URL to the project's browsable SCM repository, such as ViewVC or Fisheye. 829 | <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 4.0.0+ 839 | A repository contains the information needed for establishing connections with 840 | remote repository. 841 | 842 | 843 | 844 | 845 | 4.0.0+ 846 | How to handle downloading of releases from this repository. 847 | 848 | 849 | 850 | 851 | 4.0.0+ 852 | How to handle downloading of snapshots from this repository. 853 | 854 | 855 | 856 | 857 | 4.0.0+ 858 | 859 | 860 | A unique identifier for a repository. This is used to match the repository 861 | to configuration in the <code>settings.xml</code> file, for example. Furthermore, the identifier is 862 | used during POM inheritance and profile injection to detect repositories that should be merged. 863 | 864 | 865 | 866 | 867 | 868 | 869 | 4.0.0+ 870 | Human readable name of the repository. 871 | 872 | 873 | 874 | 875 | 4.0.0+ 876 | 877 | 878 | The url of the repository, in the form <code>protocol://hostname/path</code>. 879 | 880 | 881 | 882 | 883 | 884 | 885 | 4.0.0+ 886 | 887 | 888 | The type of layout this repository uses for locating and storing artifacts - 889 | can be <code>legacy</code> or <code>default</code>. 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 4.0.0+ 899 | Information about the issue tracking (or bug tracking) system used to manage this 900 | project. 901 | 902 | 903 | 904 | 905 | 4.0.0+ 906 | The name of the issue management system, e.g. Bugzilla 907 | 908 | 909 | 910 | 911 | 4.0.0+ 912 | URL for the issue management system used by the project. 913 | 914 | 915 | 916 | 917 | 918 | 919 | 4.0.0+ 920 | 921 | 922 | The <code>&lt;CiManagement&gt;</code> element contains informations required to the 923 | continuous integration system of the project. 924 | 925 | 926 | 927 | 928 | 929 | 930 | 4.0.0+ 931 | 932 | 933 | The name of the continuous integration system, e.g. <code>continuum</code>. 934 | 935 | 936 | 937 | 938 | 939 | 940 | 4.0.0+ 941 | URL for the continuous integration system used by the project if it has a web 942 | interface. 943 | 944 | 945 | 946 | 947 | 4.0.0+ 948 | Configuration for notifying developers/users when a build is unsuccessful, 949 | including user information and notification mode. 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 4.0.0+ 962 | Configures one method for notifying users/developers when a build breaks. 963 | 964 | 965 | 966 | 967 | 4.0.0+ 968 | The mechanism used to deliver notifications. 969 | 970 | 971 | 972 | 973 | 4.0.0+ 974 | Whether to send notifications on error. 975 | 976 | 977 | 978 | 979 | 4.0.0+ 980 | Whether to send notifications on failure. 981 | 982 | 983 | 984 | 985 | 4.0.0+ 986 | Whether to send notifications on success. 987 | 988 | 989 | 990 | 991 | 4.0.0+ 992 | Whether to send notifications on warning. 993 | 994 | 995 | 996 | 997 | 4.0.0+ 998 | 999 | 1000 | <b>Deprecated</b>. Where to send the notification to - eg email address. 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 0.0.0+ 1008 | Extended configuration specific to this notifier goes here. 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 4.0.0+ 1021 | Modifications to the build process which is activated based on environmental 1022 | parameters or command line arguments. 1023 | 1024 | 1025 | 1026 | 1027 | 4.0.0+ 1028 | The identifier of this build profile. This is used for command line 1029 | activation, and identifies profiles to be merged. 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 4.0.0+ 1036 | The conditional logic which will automatically trigger the inclusion of this 1037 | profile. 1038 | 1039 | 1040 | 1041 | 1042 | 4.0.0+ 1043 | Information required to build the project. 1044 | 1045 | 1046 | 1047 | 1048 | 4.0.0+ 1049 | The modules (sometimes called subprojects) to build as a part of this 1050 | project. Each module listed is a relative path to the directory containing the module. 1051 | To be consistent with the way default urls are calculated from parent, it is recommended 1052 | to have module names match artifact ids. 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 4.0.0+ 1063 | Distribution information for a project that enables deployment of the site 1064 | and artifacts to remote web servers and repositories respectively. 1065 | 1066 | 1067 | 1068 | 1069 | 4.0.0+ 1070 | 1071 | 1072 | Properties that can be used throughout the POM as a substitution, and 1073 | are used as filters in resources if enabled. 1074 | The format is <code>&lt;name&gt;value&lt;/name&gt;</code>. 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 4.0.0+ 1087 | Default dependency information for projects that inherit from this one. The 1088 | dependencies in this section are not immediately resolved. Instead, when a POM derived 1089 | from this one declares a dependency described by a matching groupId and artifactId, the 1090 | version and other values from this section are used for that dependency if they were not 1091 | already specified. 1092 | 1093 | 1094 | 1095 | 1096 | 3.0.0+ 1097 | 1098 | 1099 | This element describes all of the dependencies associated with a 1100 | project. 1101 | These dependencies are used to construct a classpath for your 1102 | project during the build process. They are automatically downloaded from the 1103 | repositories defined in this project. 1104 | See <a href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">the 1105 | dependency mechanism</a> for more information. 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 4.0.0+ 1118 | The lists of the remote repositories for discovering dependencies and 1119 | extensions. 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 4.0.0+ 1130 | The lists of the remote repositories for discovering plugins for builds and 1131 | reports. 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 4.0.0+ 1142 | 1143 | 1144 | <b>Deprecated</b>. Now ignored by Maven. 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 4.0.0+ 1157 | 1158 | 1159 | This element includes the specification of report plugins to use 1160 | to generate the reports on the Maven-generated site. 1161 | These reports will be run when a user executes <code>mvn site</code>. 1162 | All of the reports will be included in the navigation bar for browsing. 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 3.0.0+ 1172 | Generic informations for a build. 1173 | 1174 | 1175 | 1176 | 1177 | 3.0.0+ 1178 | The default goal (or phase in Maven 2) to execute when none is specified for 1179 | the project. Note that in case of a multi-module build, only the default goal of the top-level 1180 | project is relevant, i.e. the default goals of child modules are ignored. Since Maven 3, 1181 | multiple goals/phases can be separated by whitespace. 1182 | 1183 | 1184 | 1185 | 1186 | 3.0.0+ 1187 | 1188 | This element describes all of the classpath resources such as properties 1189 | files associated with a project. These resources are often included in the final 1190 | package. 1191 | The default value is <code>src/main/resources</code>. 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 4.0.0+ 1203 | 1204 | This element describes all of the classpath resources such as properties 1205 | files associated with a project's unit tests. 1206 | The default value is <code>src/test/resources</code>. 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 4.0.0+ 1218 | 1219 | The directory where all files generated by the build are placed. 1220 | The default value is <code>target</code>. 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 4.0.0+ 1227 | 1228 | 1229 | The filename (excluding the extension, and with no path information) that 1230 | the produced artifact will be called. 1231 | The default value is <code>${artifactId}-${version}</code>. 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 4.0.0+ 1239 | The list of filter properties files that are used when filtering is enabled. 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 4.0.0+ 1250 | Default plugin information to be made available for reference by projects 1251 | derived from this one. This plugin configuration will not be resolved or bound to the 1252 | lifecycle unless referenced. Any local configuration for a given plugin will override 1253 | the plugin's entire definition here. 1254 | 1255 | 1256 | 1257 | 1258 | 4.0.0+ 1259 | The list of plugins to use. 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 4.0.0+ 1272 | 1273 | 1274 | The <code>&lt;plugin&gt;</code> element contains informations required for a plugin. 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 4.0.0+ 1282 | The group ID of the plugin in the repository. 1283 | 1284 | 1285 | 1286 | 1287 | 4.0.0+ 1288 | The artifact ID of the plugin in the repository. 1289 | 1290 | 1291 | 1292 | 1293 | 4.0.0+ 1294 | The version (or valid range of versions) of the plugin to be used. 1295 | 1296 | 1297 | 1298 | 1299 | 4.0.0+ 1300 | 1301 | 1302 | Whether to load Maven extensions (such as packaging and type handlers) from 1303 | this plugin. For performance reasons, this should only be enabled when necessary. Note: While the type 1304 | of this field is <code>String</code> for technical reasons, the semantic type is actually 1305 | <code>Boolean</code>. Default value is <code>false</code>. 1306 | 1307 | 1308 | 1309 | 1310 | 1311 | 1312 | 4.0.0+ 1313 | Multiple specifications of a set of goals to execute during the build 1314 | lifecycle, each having (possibly) a different configuration. 1315 | 1316 | 1317 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1324 | 4.0.0+ 1325 | Additional dependencies that this project needs to introduce to the plugin's 1326 | classloader. 1327 | 1328 | 1329 | 1330 | 1331 | 1332 | 1333 | 1334 | 1335 | 1336 | 4.0.0+ 1337 | 1338 | 1339 | <b>Deprecated</b>. Unused by Maven. 1340 | 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348 | 1349 | 1350 | 1351 | 4.0.0+ 1352 | 1353 | 1354 | Whether any configuration should be propagated to child POMs. Note: While the type 1355 | of this field is <code>String</code> for technical reasons, the semantic type is actually 1356 | <code>Boolean</code>. Default value is <code>true</code>. 1357 | 1358 | 1359 | 1360 | 1361 | 1362 | 1363 | 0.0.0+ 1364 | 1365 | 1366 | <p>The configuration as DOM object.</p> 1367 | <p>By default, every element content is trimmed, but starting with Maven 3.1.0, you can add 1368 | <code>xml:space="preserve"</code> to elements you want to preserve whitespace.</p> 1369 | <p>You can control how child POMs inherit configuration from parent POMs by adding <code>combine.children</code> 1370 | or <code>combine.self</code> attributes to the children of the configuration element:</p> 1371 | <ul> 1372 | <li><code>combine.children</code>: available values are <code>merge</code> (default) and <code>append</code>,</li> 1373 | <li><code>combine.self</code>: available values are <code>merge</code> (default) and <code>override</code>.</li> 1374 | </ul> 1375 | <p>See <a href="http://maven.apache.org/pom.html#Plugins">POM Reference documentation</a> and 1376 | <a href="http://plexus.codehaus.org/plexus-utils/apidocs/org/codehaus/plexus/util/xml/Xpp3DomUtils.html">Xpp3DomUtils</a> 1377 | for more information.</p> 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | 3.0.0+ 1392 | 1393 | 1394 | The <code>&lt;dependency&gt;</code> element contains information about a dependency 1395 | of the project. 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | 1402 | 3.0.0+ 1403 | 1404 | 1405 | The project group that produced the dependency, e.g. 1406 | <code>org.apache.maven</code>. 1407 | 1408 | 1409 | 1410 | 1411 | 1412 | 1413 | 3.0.0+ 1414 | 1415 | 1416 | The unique id for an artifact produced by the project group, e.g. 1417 | <code>maven-artifact</code>. 1418 | 1419 | 1420 | 1421 | 1422 | 1423 | 1424 | 3.0.0+ 1425 | 1426 | 1427 | The version of the dependency, e.g. <code>3.2.1</code>. In Maven 2, this can also be 1428 | specified as a range of versions. 1429 | 1430 | 1431 | 1432 | 1433 | 1434 | 1435 | 4.0.0+ 1436 | 1437 | 1438 | The type of dependency. While it 1439 | usually represents the extension on the filename of the dependency, 1440 | that is not always the case. A type can be mapped to a different 1441 | extension and a classifier. 1442 | The type often corresponds to the packaging used, though this is also 1443 | not always the case. 1444 | Some examples are <code>jar</code>, <code>war</code>, <code>ejb-client</code> 1445 | and <code>test-jar</code>: see <a href="../maven-core/artifact-handlers.html">default 1446 | artifact handlers</a> for a list. 1447 | New types can be defined by plugins that set 1448 | <code>extensions</code> to <code>true</code>, so this is not a complete list. 1449 | 1450 | 1451 | 1452 | 1453 | 1454 | 1455 | 4.0.0+ 1456 | 1457 | 1458 | The classifier of the dependency. It is appended to 1459 | the filename after the version. This allows: 1460 | <ul> 1461 | <li>refering to attached artifact, for example <code>sources</code> and <code>javadoc</code>: 1462 | see <a href="../maven-core/artifact-handlers.html">default artifact handlers</a> for a list,</li> 1463 | <li>distinguishing two artifacts 1464 | that belong to the same POM but were built differently. 1465 | For example, <code>jdk14</code> and <code>jdk15</code>.</li> 1466 | </ul> 1467 | 1468 | 1469 | 1470 | 1471 | 1472 | 1473 | 4.0.0+ 1474 | 1475 | 1476 | The scope of the dependency - <code>compile</code>, <code>runtime</code>, 1477 | <code>test</code>, <code>system</code>, and <code>provided</code>. Used to 1478 | calculate the various classpaths used for compilation, testing, and so on. 1479 | It also assists in determining which artifacts to include in a distribution of 1480 | this project. For more information, see 1481 | <a href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">the 1482 | dependency mechanism</a>. 1483 | 1484 | 1485 | 1486 | 1487 | 1488 | 1489 | 4.0.0+ 1490 | 1491 | 1492 | FOR SYSTEM SCOPE ONLY. Note that use of this property is <b>discouraged</b> 1493 | and may be replaced in later versions. This specifies the path on the filesystem 1494 | for this dependency. 1495 | Requires an absolute path for the value, not relative. 1496 | Use a property that gives the machine specific absolute path, 1497 | e.g. <code>${java.home}</code>. 1498 | 1499 | 1500 | 1501 | 1502 | 1503 | 1504 | 4.0.0+ 1505 | Lists a set of artifacts that should be excluded from this dependency's 1506 | artifact list when it comes to calculating transitive dependencies. 1507 | 1508 | 1509 | 1510 | 1511 | 1512 | 1513 | 1514 | 1515 | 1516 | 4.0.0+ 1517 | 1518 | 1519 | Indicates the dependency is optional for use of this library. While the 1520 | version of the dependency will be taken into account for dependency calculation if the 1521 | library is used elsewhere, it will not be passed on transitively. Note: While the type 1522 | of this field is <code>String</code> for technical reasons, the semantic type is actually 1523 | <code>Boolean</code>. Default value is <code>false</code>. 1524 | 1525 | 1526 | 1527 | 1528 | 1529 | 1530 | 1531 | 1532 | 4.0.0+ 1533 | 1534 | 1535 | The <code>&lt;exclusion&gt;</code> element contains informations required to exclude 1536 | an artifact to the project. 1537 | 1538 | 1539 | 1540 | 1541 | 1542 | 1543 | 4.0.0+ 1544 | The artifact ID of the project to exclude. 1545 | 1546 | 1547 | 1548 | 1549 | 4.0.0+ 1550 | The group ID of the project to exclude. 1551 | 1552 | 1553 | 1554 | 1555 | 1556 | 1557 | 4.0.0+ 1558 | 1559 | 1560 | The <code>&lt;execution&gt;</code> element contains informations required for the 1561 | execution of a plugin. 1562 | 1563 | 1564 | 1565 | 1566 | 1567 | 1568 | 4.0.0+ 1569 | The identifier of this execution for labelling the goals during the build, 1570 | and for matching executions to merge during inheritance and profile injection. 1571 | 1572 | 1573 | 1574 | 1575 | 4.0.0+ 1576 | The build lifecycle phase to bind the goals in this execution to. If omitted, 1577 | the goals will be bound to the default phase specified by the plugin. 1578 | 1579 | 1580 | 1581 | 1582 | 4.0.0+ 1583 | The goals to execute with the given configuration. 1584 | 1585 | 1586 | 1587 | 1588 | 1589 | 1590 | 1591 | 1592 | 1593 | 4.0.0+ 1594 | 1595 | 1596 | Whether any configuration should be propagated to child POMs. Note: While the type 1597 | of this field is <code>String</code> for technical reasons, the semantic type is actually 1598 | <code>Boolean</code>. Default value is <code>true</code>. 1599 | 1600 | 1601 | 1602 | 1603 | 1604 | 1605 | 0.0.0+ 1606 | 1607 | 1608 | <p>The configuration as DOM object.</p> 1609 | <p>By default, every element content is trimmed, but starting with Maven 3.1.0, you can add 1610 | <code>xml:space="preserve"</code> to elements you want to preserve whitespace.</p> 1611 | <p>You can control how child POMs inherit configuration from parent POMs by adding <code>combine.children</code> 1612 | or <code>combine.self</code> attributes to the children of the configuration element:</p> 1613 | <ul> 1614 | <li><code>combine.children</code>: available values are <code>merge</code> (default) and <code>append</code>,</li> 1615 | <li><code>combine.self</code>: available values are <code>merge</code> (default) and <code>override</code>.</li> 1616 | </ul> 1617 | <p>See <a href="http://maven.apache.org/pom.html#Plugins">POM Reference documentation</a> and 1618 | <a href="http://plexus.codehaus.org/plexus-utils/apidocs/org/codehaus/plexus/util/xml/Xpp3DomUtils.html">Xpp3DomUtils</a> 1619 | for more information.</p> 1620 | 1621 | 1622 | 1623 | 1624 | 1625 | 1626 | 1627 | 1628 | 1629 | 1630 | 1631 | 1632 | 1633 | 3.0.0+ 1634 | This element describes all of the classpath resources associated with a project 1635 | or unit tests. 1636 | 1637 | 1638 | 1639 | 1640 | 3.0.0+ 1641 | 1642 | 1643 | Describe the resource target path. The path is relative to the target/classes 1644 | directory (i.e. <code>${project.build.outputDirectory}</code>). 1645 | For example, if you want that resource to appear in a specific package 1646 | (<code>org.apache.maven.messages</code>), you must specify this 1647 | element with this value: <code>org/apache/maven/messages</code>. 1648 | This is not required if you simply put the resources in that directory 1649 | structure at the source, however. 1650 | 1651 | 1652 | 1653 | 1654 | 1655 | 1656 | 3.0.0+ 1657 | 1658 | 1659 | Whether resources are filtered to replace tokens with parameterised values or not. 1660 | The values are taken from the <code>properties</code> element and from the 1661 | properties in the files listed in the <code>filters</code> element. Note: While the type 1662 | of this field is <code>String</code> for technical reasons, the semantic type is actually 1663 | <code>Boolean</code>. Default value is <code>false</code>. 1664 | 1665 | 1666 | 1667 | 1668 | 1669 | 1670 | 3.0.0+ 1671 | Describe the directory where the resources are stored. The path is relative 1672 | to the POM. 1673 | 1674 | 1675 | 1676 | 1677 | 3.0.0+ 1678 | 1679 | 1680 | A list of patterns to include, e.g. <code>**&#47;*.xml</code>. 1681 | 1682 | 1683 | 1684 | 1685 | 1686 | 1687 | 1688 | 1689 | 1690 | 1691 | 1692 | 3.0.0+ 1693 | 1694 | 1695 | A list of patterns to exclude, e.g. <code>**&#47;*.xml</code> 1696 | 1697 | 1698 | 1699 | 1700 | 1701 | 1702 | 1703 | 1704 | 1705 | 1706 | 1707 | 1708 | 1709 | 4.0.0+ 1710 | Section for management of default plugin information for use in a group of POMs. 1711 | 1712 | 1713 | 1714 | 1715 | 1716 | 4.0.0+ 1717 | The list of plugins to use. 1718 | 1719 | 1720 | 1721 | 1722 | 1723 | 1724 | 1725 | 1726 | 1727 | 1728 | 1729 | 4.0.0+ 1730 | Section for management of reports and their configuration. 1731 | 1732 | 1733 | 1734 | 1735 | 4.0.0+ 1736 | 1737 | 1738 | If true, then the default reports are not included in the site generation. 1739 | This includes the reports in the "Project Info" menu. Note: While the type 1740 | of this field is <code>String</code> for technical reasons, the semantic type is actually 1741 | <code>Boolean</code>. Default value is <code>false</code>. 1742 | 1743 | 1744 | 1745 | 1746 | 1747 | 1748 | 4.0.0+ 1749 | 1750 | 1751 | Where to store all of the generated reports. The default is 1752 | <code>${project.build.directory}/site</code>. 1753 | 1754 | 1755 | 1756 | 1757 | 1758 | 1759 | 4.0.0+ 1760 | The reporting plugins to use and their configuration. 1761 | 1762 | 1763 | 1764 | 1765 | 1766 | 1767 | 1768 | 1769 | 1770 | 1771 | 1772 | 4.0.0+ 1773 | 1774 | 1775 | The <code>&lt;plugin&gt;</code> element contains informations required for a report plugin. 1776 | 1777 | 1778 | 1779 | 1780 | 1781 | 1782 | 4.0.0+ 1783 | The group ID of the reporting plugin in the repository. 1784 | 1785 | 1786 | 1787 | 1788 | 4.0.0+ 1789 | The artifact ID of the reporting plugin in the repository. 1790 | 1791 | 1792 | 1793 | 1794 | 4.0.0+ 1795 | The version of the reporting plugin to be used. 1796 | 1797 | 1798 | 1799 | 1800 | 4.0.0+ 1801 | 1802 | 1803 | Multiple specifications of a set of reports, each having (possibly) different 1804 | configuration. This is the reporting parallel to an <code>execution</code> in the build. 1805 | 1806 | 1807 | 1808 | 1809 | 1810 | 1811 | 1812 | 1813 | 1814 | 1815 | 1816 | 4.0.0+ 1817 | 1818 | 1819 | Whether any configuration should be propagated to child POMs. Note: While the type 1820 | of this field is <code>String</code> for technical reasons, the semantic type is actually 1821 | <code>Boolean</code>. Default value is <code>true</code>. 1822 | 1823 | 1824 | 1825 | 1826 | 1827 | 1828 | 0.0.0+ 1829 | 1830 | 1831 | <p>The configuration as DOM object.</p> 1832 | <p>By default, every element content is trimmed, but starting with Maven 3.1.0, you can add 1833 | <code>xml:space="preserve"</code> to elements you want to preserve whitespace.</p> 1834 | <p>You can control how child POMs inherit configuration from parent POMs by adding <code>combine.children</code> 1835 | or <code>combine.self</code> attributes to the children of the configuration element:</p> 1836 | <ul> 1837 | <li><code>combine.children</code>: available values are <code>merge</code> (default) and <code>append</code>,</li> 1838 | <li><code>combine.self</code>: available values are <code>merge</code> (default) and <code>override</code>.</li> 1839 | </ul> 1840 | <p>See <a href="http://maven.apache.org/pom.html#Plugins">POM Reference documentation</a> and 1841 | <a href="http://plexus.codehaus.org/plexus-utils/apidocs/org/codehaus/plexus/util/xml/Xpp3DomUtils.html">Xpp3DomUtils</a> 1842 | for more information.</p> 1843 | 1844 | 1845 | 1846 | 1847 | 1848 | 1849 | 1850 | 1851 | 1852 | 1853 | 1854 | 1855 | 1856 | 4.0.0+ 1857 | Represents a set of reports and configuration to be used to generate them. 1858 | 1859 | 1860 | 1861 | 1862 | 0.0.0+ 1863 | The unique id for this report set, to be used during POM inheritance and profile injection 1864 | for merging of report sets. 1865 | 1866 | 1867 | 1868 | 1869 | 1870 | 4.0.0+ 1871 | The list of reports from this plugin which should be generated from this set. 1872 | 1873 | 1874 | 1875 | 1876 | 1877 | 1878 | 1879 | 1880 | 1881 | 4.0.0+ 1882 | 1883 | 1884 | Whether any configuration should be propagated to child POMs. Note: While the type 1885 | of this field is <code>String</code> for technical reasons, the semantic type is actually 1886 | <code>Boolean</code>. Default value is <code>true</code>. 1887 | 1888 | 1889 | 1890 | 1891 | 1892 | 1893 | 0.0.0+ 1894 | 1895 | 1896 | <p>The configuration as DOM object.</p> 1897 | <p>By default, every element content is trimmed, but starting with Maven 3.1.0, you can add 1898 | <code>xml:space="preserve"</code> to elements you want to preserve whitespace.</p> 1899 | <p>You can control how child POMs inherit configuration from parent POMs by adding <code>combine.children</code> 1900 | or <code>combine.self</code> attributes to the children of the configuration element:</p> 1901 | <ul> 1902 | <li><code>combine.children</code>: available values are <code>merge</code> (default) and <code>append</code>,</li> 1903 | <li><code>combine.self</code>: available values are <code>merge</code> (default) and <code>override</code>.</li> 1904 | </ul> 1905 | <p>See <a href="http://maven.apache.org/pom.html#Plugins">POM Reference documentation</a> and 1906 | <a href="http://plexus.codehaus.org/plexus-utils/apidocs/org/codehaus/plexus/util/xml/Xpp3DomUtils.html">Xpp3DomUtils</a> 1907 | for more information.</p> 1908 | 1909 | 1910 | 1911 | 1912 | 1913 | 1914 | 1915 | 1916 | 1917 | 1918 | 1919 | 1920 | 1921 | 4.0.0+ 1922 | The conditions within the build runtime environment which will trigger the 1923 | automatic inclusion of the build profile. Multiple conditions can be defined, which must 1924 | be all satisfied to activate the profile. 1925 | 1926 | 1927 | 1928 | 1929 | 1930 | 4.0.0+ 1931 | If set to true, this profile will be active unless another profile in this 1932 | pom is activated using the command line -P option or by one of that profile's 1933 | activators. 1934 | 1935 | 1936 | 1937 | 1938 | 4.0.0+ 1939 | 1940 | 1941 | Specifies that this profile will be activated when a matching JDK is detected. 1942 | For example, <code>1.4</code> only activates on JDKs versioned 1.4, 1943 | while <code>!1.4</code> matches any JDK that is not version 1.4. Ranges are supported too: 1944 | <code>[1.5,)</code> activates when the JDK is 1.5 minimum. 1945 | 1946 | 1947 | 1948 | 1949 | 1950 | 1951 | 4.0.0+ 1952 | Specifies that this profile will be activated when matching operating system 1953 | attributes are detected. 1954 | 1955 | 1956 | 1957 | 1958 | 4.0.0+ 1959 | Specifies that this profile will be activated when this system property is 1960 | specified. 1961 | 1962 | 1963 | 1964 | 1965 | 4.0.0+ 1966 | Specifies that this profile will be activated based on existence of a file. 1967 | 1968 | 1969 | 1970 | 1971 | 1972 | 1973 | 4.0.0+ 1974 | This is the property specification used to activate a profile. If the value field 1975 | is empty, then the existence of the named property will activate the profile, otherwise it 1976 | does a case-sensitive match against the property value as well. 1977 | 1978 | 1979 | 1980 | 1981 | 4.0.0+ 1982 | The name of the property to be used to activate a profile. 1983 | 1984 | 1985 | 1986 | 1987 | 4.0.0+ 1988 | The value of the property required to activate a profile. 1989 | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 4.0.0+ 1996 | This is an activator which will detect an operating system's attributes in order 1997 | to activate its profile. 1998 | 1999 | 2000 | 2001 | 2002 | 4.0.0+ 2003 | 2004 | 2005 | The name of the operating system to be used to activate the profile. This must be an exact match 2006 | of the <code>${os.name}</code> Java property, such as <code>Windows XP</code>. 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 4.0.0+ 2014 | 2015 | 2016 | The general family of the OS to be used to activate the profile, such as 2017 | <code>windows</code> or <code>unix</code>. 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 4.0.0+ 2025 | The architecture of the operating system to be used to activate the 2026 | profile. 2027 | 2028 | 2029 | 2030 | 2031 | 4.0.0+ 2032 | The version of the operating system to be used to activate the 2033 | profile. 2034 | 2035 | 2036 | 2037 | 2038 | 2039 | 2040 | 4.0.0+ 2041 | This is the file specification used to activate the profile. The <code>missing</code> value 2042 | is the location of a file that needs to exist, and if it doesn't, the profile will be 2043 | activated. On the other hand, <code>exists</code> will test for the existence of the file and if it is 2044 | there, the profile will be activated.<br/> 2045 | Variable interpolation for these file specifications is limited to <code>${basedir}</code>, 2046 | System properties and request properties. 2047 | 2048 | 2049 | 2050 | 2051 | 4.0.0+ 2052 | The name of the file that must be missing to activate the 2053 | profile. 2054 | 2055 | 2056 | 2057 | 2058 | 4.0.0+ 2059 | The name of the file that must exist to activate the profile. 2060 | 2061 | 2062 | 2063 | 2064 | 2065 | 2066 | 4.0.0+ 2067 | Section for management of default dependency information for use in a group of 2068 | POMs. 2069 | 2070 | 2071 | 2072 | 2073 | 4.0.0+ 2074 | The dependencies specified here are not used until they are referenced in a 2075 | POM within the group. This allows the specification of a "standard" version for a 2076 | particular dependency. 2077 | 2078 | 2079 | 2080 | 2081 | 2082 | 2083 | 2084 | 2085 | 2086 | 2087 | 2088 | 3.0.0+ 2089 | 2090 | 2091 | The <code>&lt;build&gt;</code> element contains informations required to build the project. 2092 | Default values are defined in Super POM. 2093 | 2094 | 2095 | 2096 | 2097 | 2098 | 2099 | 3.0.0+ 2100 | 2101 | This element specifies a directory containing the source of the project. The 2102 | generated build system will compile the sources from this directory when the project is 2103 | built. The path given is relative to the project descriptor. 2104 | The default value is <code>src/main/java</code>. 2105 | 2106 | 2107 | 2108 | 2109 | 2110 | 4.0.0+ 2111 | 2112 | This element specifies a directory containing the script sources of the 2113 | project. This directory is meant to be different from the sourceDirectory, in that its 2114 | contents will be copied to the output directory in most cases (since scripts are 2115 | interpreted rather than compiled). 2116 | The default value is <code>src/main/scripts</code>. 2117 | 2118 | 2119 | 2120 | 2121 | 2122 | 4.0.0+ 2123 | 2124 | This element specifies a directory containing the unit test source of the 2125 | project. The generated build system will compile these directories when the project is 2126 | being tested. The path given is relative to the project descriptor. 2127 | The default value is <code>src/test/java</code>. 2128 | 2129 | 2130 | 2131 | 2132 | 2133 | 4.0.0+ 2134 | 2135 | The directory where compiled application classes are placed. 2136 | The default value is <code>target/classes</code>. 2137 | 2138 | 2139 | 2140 | 2141 | 2142 | 4.0.0+ 2143 | 2144 | The directory where compiled test classes are placed. 2145 | The default value is <code>target/test-classes</code>. 2146 | 2147 | 2148 | 2149 | 2150 | 2151 | 4.0.0+ 2152 | A set of build extensions to use from this project. 2153 | 2154 | 2155 | 2156 | 2157 | 2158 | 2159 | 2160 | 2161 | 2162 | 3.0.0+ 2163 | The default goal (or phase in Maven 2) to execute when none is specified for 2164 | the project. Note that in case of a multi-module build, only the default goal of the top-level 2165 | project is relevant, i.e. the default goals of child modules are ignored. Since Maven 3, 2166 | multiple goals/phases can be separated by whitespace. 2167 | 2168 | 2169 | 2170 | 2171 | 3.0.0+ 2172 | 2173 | This element describes all of the classpath resources such as properties 2174 | files associated with a project. These resources are often included in the final 2175 | package. 2176 | The default value is <code>src/main/resources</code>. 2177 | 2178 | 2179 | 2180 | 2181 | 2182 | 2183 | 2184 | 2185 | 2186 | 2187 | 4.0.0+ 2188 | 2189 | This element describes all of the classpath resources such as properties 2190 | files associated with a project's unit tests. 2191 | The default value is <code>src/test/resources</code>. 2192 | 2193 | 2194 | 2195 | 2196 | 2197 | 2198 | 2199 | 2200 | 2201 | 2202 | 4.0.0+ 2203 | 2204 | The directory where all files generated by the build are placed. 2205 | The default value is <code>target</code>. 2206 | 2207 | 2208 | 2209 | 2210 | 2211 | 4.0.0+ 2212 | 2213 | 2214 | The filename (excluding the extension, and with no path information) that 2215 | the produced artifact will be called. 2216 | The default value is <code>${artifactId}-${version}</code>. 2217 | 2218 | 2219 | 2220 | 2221 | 2222 | 2223 | 4.0.0+ 2224 | The list of filter properties files that are used when filtering is enabled. 2225 | 2226 | 2227 | 2228 | 2229 | 2230 | 2231 | 2232 | 2233 | 2234 | 4.0.0+ 2235 | Default plugin information to be made available for reference by projects 2236 | derived from this one. This plugin configuration will not be resolved or bound to the 2237 | lifecycle unless referenced. Any local configuration for a given plugin will override 2238 | the plugin's entire definition here. 2239 | 2240 | 2241 | 2242 | 2243 | 4.0.0+ 2244 | The list of plugins to use. 2245 | 2246 | 2247 | 2248 | 2249 | 2250 | 2251 | 2252 | 2253 | 2254 | 2255 | 2256 | 4.0.0+ 2257 | Describes a build extension to utilise. 2258 | 2259 | 2260 | 2261 | 2262 | 4.0.0+ 2263 | The group ID of the extension's artifact. 2264 | 2265 | 2266 | 2267 | 2268 | 4.0.0+ 2269 | The artifact ID of the extension. 2270 | 2271 | 2272 | 2273 | 2274 | 4.0.0+ 2275 | The version of the extension. 2276 | 2277 | 2278 | 2279 | 2280 | 2281 | 2282 | 3.0.0+ 2283 | Describes the licenses for this project. This is used to generate the license 2284 | page of the project's web site, as well as being taken into consideration in other reporting 2285 | and validation. The licenses listed for the project are that of the project itself, and not 2286 | of dependencies. 2287 | 2288 | 2289 | 2290 | 2291 | 3.0.0+ 2292 | The full legal name of the license. 2293 | 2294 | 2295 | 2296 | 2297 | 3.0.0+ 2298 | The official url for the license text. 2299 | 2300 | 2301 | 2302 | 2303 | 3.0.0+ 2304 | 2305 | 2306 | The primary method by which this project may be distributed. 2307 | <dl> 2308 | <dt>repo</dt> 2309 | <dd>may be downloaded from the Maven repository</dd> 2310 | <dt>manual</dt> 2311 | <dd>user must manually download and install the dependency.</dd> 2312 | </dl> 2313 | 2314 | 2315 | 2316 | 2317 | 2318 | 2319 | 3.0.0+ 2320 | Addendum information pertaining to this license. 2321 | 2322 | 2323 | 2324 | 2325 | 2326 | 2327 | 3.0.0+ 2328 | This element describes all of the mailing lists associated with a project. The 2329 | auto-generated site references this information. 2330 | 2331 | 2332 | 2333 | 2334 | 3.0.0+ 2335 | 2336 | 2337 | The name of the mailing list. 2338 | 2339 | 2340 | 2341 | 2342 | 2343 | 2344 | 3.0.0+ 2345 | 2346 | 2347 | The email address or link that can be used to subscribe to 2348 | the mailing list. If this is an email address, a 2349 | <code>mailto:</code> link will automatically be created 2350 | when the documentation is created. 2351 | 2352 | 2353 | 2354 | 2355 | 2356 | 2357 | 3.0.0+ 2358 | 2359 | 2360 | The email address or link that can be used to unsubscribe to 2361 | the mailing list. If this is an email address, a 2362 | <code>mailto:</code> link will automatically be created 2363 | when the documentation is created. 2364 | 2365 | 2366 | 2367 | 2368 | 2369 | 2370 | 3.0.0+ 2371 | 2372 | 2373 | The email address or link that can be used to post to 2374 | the mailing list. If this is an email address, a 2375 | <code>mailto:</code> link will automatically be created 2376 | when the documentation is created. 2377 | 2378 | 2379 | 2380 | 2381 | 2382 | 2383 | 3.0.0+ 2384 | The link to a URL where you can browse the mailing list archive. 2385 | 2386 | 2387 | 2388 | 2389 | 3.0.0+ 2390 | The link to alternate URLs where you can browse the list archive. 2391 | 2392 | 2393 | 2394 | 2395 | 2396 | 2397 | 2398 | 2399 | 2400 | 2401 | 2402 | 3.0.0+ 2403 | Information about one of the committers on this project. 2404 | 2405 | 2406 | 2407 | 2408 | 3.0.0+ 2409 | The unique ID of the developer in the SCM. 2410 | 2411 | 2412 | 2413 | 2414 | 3.0.0+ 2415 | The full name of the contributor. 2416 | 2417 | 2418 | 2419 | 2420 | 3.0.0+ 2421 | The email address of the contributor. 2422 | 2423 | 2424 | 2425 | 2426 | 3.0.0+ 2427 | The URL for the homepage of the contributor. 2428 | 2429 | 2430 | 2431 | 2432 | 3.0.0+ 2433 | The organization to which the contributor belongs. 2434 | 2435 | 2436 | 2437 | 2438 | 3.0.0+ 2439 | The URL of the organization. 2440 | 2441 | 2442 | 2443 | 2444 | 3.0.0+ 2445 | 2446 | 2447 | The roles the contributor plays in the project. Each role is described by a 2448 | <code>role</code> element, the body of which is a role name. This can also be used to 2449 | describe the contribution. 2450 | 2451 | 2452 | 2453 | 2454 | 2455 | 2456 | 2457 | 2458 | 2459 | 2460 | 2461 | 3.0.0+ 2462 | 2463 | 2464 | The timezone the contributor is in. Typically, this is a number in the range 2465 | <a href="http://en.wikipedia.org/wiki/UTC%E2%88%9212:00">-12</a> to <a href="http://en.wikipedia.org/wiki/UTC%2B14:00">+14</a> 2466 | or a valid time zone id like "America/Montreal" (UTC-05:00) or "Europe/Paris" (UTC+01:00). 2467 | 2468 | 2469 | 2470 | 2471 | 2472 | 2473 | 3.0.0+ 2474 | Properties about the contributor, such as an instant messenger handle. 2475 | 2476 | 2477 | 2478 | 2479 | 2480 | 2481 | 2482 | 2483 | 2484 | --------------------------------------------------------------------------------