Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JAVA-MAVEN-2.ECLASS(5) portage JAVA-MAVEN-2.ECLASS(5)
- NAME
- java-maven-2.eclass - Eclass for building maven based Java packages and bootstraping maven
- DESCRIPTION
- This eclass provides two purposes. 1) Building maven-based packages 2) Bootstrapping Maven itself
- 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-
- in. It is handled via the variable JAVA_MAVEN_BUILD_SYSTEM possibles values for it are:
- eant: if set use any generated build.xml found.
- maven: if set use maven as the builder
- For multi projects use JAVA_MAVEN_PROJECTS which is a space separated list of inner modules to build in a maven multiproject based build.
- Remember to generate all necessary build.xml. Normally, doing mvn ant:ant on the parent project is sufficient. If the generated build.xml
- 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:
- doesn't contain any javac target but some is needed,
- 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"
- and "source" uses in IUSE.
- FUNCTIONS
- emaven [ant:ant | EMAVEN_BUILD_TARGET [-Dmaven.test.skip=true] [-X] [-e]]
- 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
- 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
- source/target versions and desactivate its own dependencies. Also, use profile with caution for the same reason !
- java-maven-2_rewrite_poms pom_location...
- Rewrite the poms to be portage friendly takes poms as args This removes the <dependencies> node from the pom file, and rewrites it with
- the dependencies provided by JAVA_MAVEN_CLASSPATH. It uses system <scope> and <systemPath> nodes (in pom.xml) to point to the system-
- level jars. For example,
- <dependency>
- <groupId>gentoo.group.id.tmp</groupId>
- <artifactId>gentoo9</artifactId>
- <version>666</version>
- <scope>system</scope>
- <systemPath>/usr/share/maven-artifact/lib/maven-artifact.jar</systemPath>
- </dependency>
- Further, this adds ths JDK and JRE versions the ebuild has specified to build this package. These gets rewritten to in the maven-com-
- piler-plugin.
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <target>1.5</target>
- <source>1.5</source>
- </configuration>
- </plugin>
- 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-
- agers need to replace the version of the parent node. It should be noted that the version element is mandatory in the <parent> node.
- Variables MAVEN_PARENTPOM_UNIQUE_ID and MAVEN_REWRITE_PARENT_OF_SUBMODULES controls this.
- java-maven-2-gen_build_xml
- 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
- project.xml
- java-maven-2-gen_build_xml patch...
- Default src_unpack function Unpacks the tarballs specified in SRC_URI. If generated sources are added, it will be at {P}-gen-
- src.tar.bz2. The value is controlled by MVN_MOD_GEN_SRC Takes a list of patches as arguments which should be defined in
- JAVA_MAVEN_PATCHES variable in an ebuild. Calls java-maven-2_rewrite_poms to rewrite the poms.
- java-maven-2_src_compile_from_build_xml
- src_compile for packages to be built via ant. Uses the generated/packaged ant script (build.xml).
- JAVA_MAVEN_PROJECTS - Space separated list of inner modules to build in a
- maven multi-module based build.
- JAVA_ANT_BSFIX_EXTRA_ARGS - Adds an additional parameter "--maven-cleaning"
- It will remove the 'depends' attribute from all
- <target>s. When calling eant make sure
- EANT_BUILD_TARGET is set with all necessary
- targets.
- EANT_BUILD_TARGET - the ant target/targets to execute
- (default: "clean compile jar").
- EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the
- gentoo.classpath property. Be sure to call
- java-ant_rewrite-classpath in src_unpack.
- java-maven-2_src_compile
- src_compile for maven-based java packages. Supports two build systems; maven itself, and ant using `mvn ant:ant` feature. variables:
- EMAVEN_BUILD_TARGET - the maven phases/life-cycles to execute (default: package)
- EMAVEN_EXTRA_ARGS - extra arguments to pass to emaven. Contains
- -Dmaven.test.skip=true and -DskipTests by args by default
- java-maven-2_src_test
- Default src_test for the eclass. This functions isn't exported via EXPORT_FUNCTIONS. So, manually call this in the ebuild's src_test.
- EMAVEN_TEST_TARGET controls the test target for maven while, EANT_TEST_TARGET controls test targets for ant.
- java-maven-2_do_sig input_file
- Do md5sum and sha1sum of a specified file in maven format
- java-maven-2_install_file_into_repo repo_dir input_file
- Do signatures and install into maven repository. First arguement is inner repository directory where the files goes. It must be cre-
- ated before calling this funcion. Second argument is the file itself The repository is the fake-repo created for use at system-level.
- java-maven-2_ensure_repo_exists
- If repositories are not created yet, create them. Two repositories are created. One for use by Portage when building maven based pack-
- ages, another for the root user
- java-maven-2_get_name
- Get versionated name of a pom taking ${POM_XML} as default format: mavenArtifact-mavenVersion
- java-maven-2_get_repo_dir pom
- Returns the directory inside the fake-maven-repo where all stuff of the given pom will be installed including a symlinked jar. Takes a
- pom in input or ${POM_XML} as default
- java-maven-2_verify_pom pom
- return ${POM_XML} or arg1 if arg1 is given and the location exists
- java-maven-2_install_one
- Installs specified sub-module of the package. This function handles all the installation stuff while java-maven_src_install works as a
- 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.
- Along with that, other stuff like pom, signatures will be installed to the repo.
- don't forget to cd to pom dir before calling
- * take a maven pom as input and use ${POM_XML} as default pom.
- java-maven-2_src_install
- Default src_install function
- Installs all the sub-projects/modules. Calls java-maven-2_install_one for installing
- If doc use flag is set, then dojavadoc
- If source use flag is set, creates a source tarball at sources/${PN}-src.zip
- Installs the poms to JAVA_MAVEN_POMS_TARBALL.
- MAINTAINERS
- java@gentoo.org
- Author : Kiorky <kiorky@cryptelium.net>
- Author : Kasun Gajasinghe <kasunbg@gmail.com>
- REPORTING BUGS
- Please report bugs via http://bugs.gentoo.org/
- FILES
- /usr/portage/eclass/java-maven-2.eclass
- SEE ALSO
- ebuild(5)
- Portage Aug 2011 JAVA-MAVEN-2.ECLASS(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement