Advertisement
ravana

manpage - java-maven-2.eclass

Aug 20th, 2011
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.67 KB | None | 0 0
  1. JAVA-MAVEN-2.ECLASS(5) portage JAVA-MAVEN-2.ECLASS(5)
  2.  
  3. NAME
  4. java-maven-2.eclass - Eclass for building maven based Java packages and bootstraping maven
  5.  
  6. DESCRIPTION
  7. This eclass provides two purposes. 1) Building maven-based packages 2) Bootstrapping Maven itself
  8.  
  9. We provide two ways to build maven based ebuilds. The first is with maven itself. The second is via generated build.xml by the maven-ant plug-
  10. in. It is handled via the variable JAVA_MAVEN_BUILD_SYSTEM possibles values for it are:
  11. eant: if set use any generated build.xml found.
  12. maven: if set use maven as the builder
  13.  
  14. For multi projects use JAVA_MAVEN_PROJECTS which is a space separated list of inner modules to build in a maven multiproject based build.
  15. Remember to generate all necessary build.xml. Normally, doing mvn ant:ant on the parent project is sufficient. If the generated build.xml
  16. doesn't fit to your needs, you can use your own build.xml to compile and assembly sources by placing it in ${FILESDIR}/build-${PV}.xml. eg:
  17. doesn't contain any javac target but some is needed,
  18.  
  19. For javadoc generation and source bundling, you can set JAVA_MAVEN_SRC_DIRS as a comma sepated list of java source directories and add "doc"
  20. and "source" uses in IUSE.
  21.  
  22. FUNCTIONS
  23. emaven [ant:ant | EMAVEN_BUILD_TARGET [-Dmaven.test.skip=true] [-X] [-e]]
  24. maven launcher function first, we rewrite pom.xml release-pom.xml in the current dir and in parent dir if this is a child pom. Please
  25. do not put in extra args some -f arg as we rewrite poms not to use maven dependencies. Goal is to feed maven with our classpath, set
  26. source/target versions and desactivate its own dependencies. Also, use profile with caution for the same reason !
  27.  
  28. java-maven-2_rewrite_poms pom_location...
  29. Rewrite the poms to be portage friendly takes poms as args This removes the <dependencies> node from the pom file, and rewrites it with
  30. the dependencies provided by JAVA_MAVEN_CLASSPATH. It uses system <scope> and <systemPath> nodes (in pom.xml) to point to the system-
  31. level jars. For example,
  32. <dependency>
  33. <groupId>gentoo.group.id.tmp</groupId>
  34. <artifactId>gentoo9</artifactId>
  35. <version>666</version>
  36. <scope>system</scope>
  37. <systemPath>/usr/share/maven-artifact/lib/maven-artifact.jar</systemPath>
  38. </dependency>
  39.  
  40. Further, this adds ths JDK and JRE versions the ebuild has specified to build this package. These gets rewritten to in the maven-com-
  41. piler-plugin.
  42. <plugin>
  43. <groupId>org.apache.maven.plugins</groupId>
  44. <artifactId>maven-compiler-plugin</artifactId>
  45. <configuration>
  46. <target>1.5</target>
  47. <source>1.5</source>
  48. </configuration>
  49. </plugin>
  50.  
  51. Further, the <parent> node also can be rewritten if the parent in the pom is not suited for you. Most probable case is that the pack-
  52. agers need to replace the version of the parent node. It should be noted that the version element is mandatory in the <parent> node.
  53. Variables MAVEN_PARENTPOM_UNIQUE_ID and MAVEN_REWRITE_PARENT_OF_SUBMODULES controls this.
  54.  
  55. java-maven-2-gen_build_xml
  56. In case we are using maven-1, we will need to generate a build.xml to apply our classpath. Generates a build.xml where ever there is a
  57. project.xml
  58.  
  59. java-maven-2-gen_build_xml patch...
  60. Default src_unpack function Unpacks the tarballs specified in SRC_URI. If generated sources are added, it will be at {P}-gen-
  61. src.tar.bz2. The value is controlled by MVN_MOD_GEN_SRC Takes a list of patches as arguments which should be defined in
  62. JAVA_MAVEN_PATCHES variable in an ebuild. Calls java-maven-2_rewrite_poms to rewrite the poms.
  63.  
  64. java-maven-2_src_compile_from_build_xml
  65. src_compile for packages to be built via ant. Uses the generated/packaged ant script (build.xml).
  66. JAVA_MAVEN_PROJECTS - Space separated list of inner modules to build in a
  67. maven multi-module based build.
  68. JAVA_ANT_BSFIX_EXTRA_ARGS - Adds an additional parameter "--maven-cleaning"
  69. It will remove the 'depends' attribute from all
  70. <target>s. When calling eant make sure
  71. EANT_BUILD_TARGET is set with all necessary
  72. targets.
  73. EANT_BUILD_TARGET - the ant target/targets to execute
  74. (default: "clean compile jar").
  75. EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the
  76. gentoo.classpath property. Be sure to call
  77. java-ant_rewrite-classpath in src_unpack.
  78.  
  79. java-maven-2_src_compile
  80. src_compile for maven-based java packages. Supports two build systems; maven itself, and ant using `mvn ant:ant` feature. variables:
  81. EMAVEN_BUILD_TARGET - the maven phases/life-cycles to execute (default: package)
  82. EMAVEN_EXTRA_ARGS - extra arguments to pass to emaven. Contains
  83. -Dmaven.test.skip=true and -DskipTests by args by default
  84.  
  85. java-maven-2_src_test
  86. Default src_test for the eclass. This functions isn't exported via EXPORT_FUNCTIONS. So, manually call this in the ebuild's src_test.
  87. EMAVEN_TEST_TARGET controls the test target for maven while, EANT_TEST_TARGET controls test targets for ant.
  88.  
  89. java-maven-2_do_sig input_file
  90. Do md5sum and sha1sum of a specified file in maven format
  91.  
  92. java-maven-2_install_file_into_repo repo_dir input_file
  93. Do signatures and install into maven repository. First arguement is inner repository directory where the files goes. It must be cre-
  94. ated before calling this funcion. Second argument is the file itself The repository is the fake-repo created for use at system-level.
  95.  
  96. java-maven-2_ensure_repo_exists
  97. If repositories are not created yet, create them. Two repositories are created. One for use by Portage when building maven based pack-
  98. ages, another for the root user
  99.  
  100. java-maven-2_get_name
  101. Get versionated name of a pom taking ${POM_XML} as default format: mavenArtifact-mavenVersion
  102.  
  103. java-maven-2_get_repo_dir pom
  104. Returns the directory inside the fake-maven-repo where all stuff of the given pom will be installed including a symlinked jar. Takes a
  105. pom in input or ${POM_XML} as default
  106.  
  107. java-maven-2_verify_pom pom
  108. return ${POM_XML} or arg1 if arg1 is given and the location exists
  109.  
  110. java-maven-2_install_one
  111. Installs specified sub-module of the package. This function handles all the installation stuff while java-maven_src_install works as a
  112. module manager. The jar will be installed to /usr/share/PN_SLOT/lib as usual. Further, the jar will be symlinked in the maven-repo.
  113. Along with that, other stuff like pom, signatures will be installed to the repo.
  114.  
  115. don't forget to cd to pom dir before calling
  116. * take a maven pom as input and use ${POM_XML} as default pom.
  117.  
  118. java-maven-2_src_install
  119. Default src_install function
  120. Installs all the sub-projects/modules. Calls java-maven-2_install_one for installing
  121. If doc use flag is set, then dojavadoc
  122. If source use flag is set, creates a source tarball at sources/${PN}-src.zip
  123. Installs the poms to JAVA_MAVEN_POMS_TARBALL.
  124.  
  125. MAINTAINERS
  126. java@gentoo.org
  127.  
  128. Author : Kiorky <kiorky@cryptelium.net>
  129.  
  130. Author : Kasun Gajasinghe <kasunbg@gmail.com>
  131.  
  132. REPORTING BUGS
  133. Please report bugs via http://bugs.gentoo.org/
  134.  
  135. FILES
  136. /usr/portage/eclass/java-maven-2.eclass
  137.  
  138. SEE ALSO
  139. ebuild(5)
  140.  
  141. Portage Aug 2011 JAVA-MAVEN-2.ECLASS(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement