MavenPackage: allow additional build args (#19676)
This commit is contained in:
@@ -76,6 +76,24 @@ should add:
|
|||||||
depends_on('maven@3.5.4:', type='build')
|
depends_on('maven@3.5.4:', type='build')
|
||||||
|
|
||||||
|
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
Passing arguments to the build phase
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The default build and install phases should be sufficient to install
|
||||||
|
most packages. However, you may want to pass additional flags to
|
||||||
|
the build phase. For example:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def build_args(self):
|
||||||
|
return [
|
||||||
|
'-Pdist,native',
|
||||||
|
'-Dtar',
|
||||||
|
'-Dmaven.javadoc.skip=true'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
External documentation
|
External documentation
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@@ -35,15 +35,19 @@ def build_directory(self):
|
|||||||
"""The directory containing the ``pom.xml`` file."""
|
"""The directory containing the ``pom.xml`` file."""
|
||||||
return self.stage.source_path
|
return self.stage.source_path
|
||||||
|
|
||||||
|
def build_args(self):
|
||||||
|
"""List of args to pass to build phase."""
|
||||||
|
return []
|
||||||
|
|
||||||
def build(self, spec, prefix):
|
def build(self, spec, prefix):
|
||||||
"""Compile code and package into a JAR file."""
|
"""Compile code and package into a JAR file."""
|
||||||
|
|
||||||
with working_dir(self.build_directory):
|
with working_dir(self.build_directory):
|
||||||
mvn = which('mvn')
|
mvn = which('mvn')
|
||||||
if self.run_tests:
|
if self.run_tests:
|
||||||
mvn('verify')
|
mvn('verify', *self.build_args())
|
||||||
else:
|
else:
|
||||||
mvn('package', '-DskipTests')
|
mvn('package', '-DskipTests', *self.build_args())
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
"""Copy to installation prefix."""
|
"""Copy to installation prefix."""
|
||||||
|
Reference in New Issue
Block a user