line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
13395
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
2
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Maven::Command; |
5
|
|
|
|
|
|
|
$Maven::Command::VERSION = '1.12'; |
6
|
|
|
|
|
|
|
# ABSTRACT: A command builder for mvn |
7
|
|
|
|
|
|
|
# PODNAME: Maven::Command |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
4
|
use Exporter qw(import); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
292
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
12
|
|
|
|
|
|
|
mvn_artifact_params |
13
|
|
|
|
|
|
|
mvn_command |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _escape_and_quote { |
17
|
12
|
|
|
12
|
|
9
|
my ($value) = @_; |
18
|
12
|
|
|
|
|
12
|
$value =~ s/\\/\\\\/g; |
19
|
12
|
|
|
|
|
6
|
$value =~ s/"/\\"/g; |
20
|
12
|
|
|
|
|
26
|
return "\"$value\""; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub mvn_artifact_params { |
24
|
1
|
|
|
1
|
1
|
2
|
my ($artifact) = @_; |
25
|
|
|
|
|
|
|
return ( |
26
|
1
|
50
|
|
|
|
4
|
groupId => $artifact->get_groupId(), |
27
|
|
|
|
|
|
|
artifactId => $artifact->get_artifactId(), |
28
|
|
|
|
|
|
|
packaging => $artifact->get_packaging(), |
29
|
|
|
|
|
|
|
( $artifact->get_classifier() |
30
|
|
|
|
|
|
|
? ( classifier => $artifact->get_classifier() ) |
31
|
|
|
|
|
|
|
: () |
32
|
|
|
|
|
|
|
), |
33
|
|
|
|
|
|
|
version => $artifact->get_version() |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub mvn_command { |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# [\%mvn_options], @goals_and_phases, [\%parameters] |
40
|
5
|
100
|
|
5
|
1
|
29
|
my $mvn_options = ref( $_[0] ) eq 'HASH' ? shift : {}; |
41
|
5
|
100
|
|
|
|
12
|
my $parameters = ref( $_[$#_] ) eq 'HASH' ? pop : {}; |
42
|
5
|
|
|
|
|
9
|
my @goals_and_phases = @_; |
43
|
|
|
|
|
|
|
|
44
|
5
|
|
|
|
|
3
|
my $mvn_options_string = ''; |
45
|
5
|
|
|
|
|
16
|
foreach my $key ( sort keys(%$mvn_options) ) { |
46
|
5
|
|
|
|
|
8
|
$mvn_options_string .= " $key"; |
47
|
5
|
|
|
|
|
5
|
my $value = $mvn_options->{$key}; |
48
|
5
|
100
|
|
|
|
9
|
if ( defined($value) ) { |
49
|
2
|
50
|
|
|
|
5
|
my $separator = ( $key =~ /^\-D/ ) ? '=' : ' '; |
50
|
2
|
|
|
|
|
4
|
$mvn_options_string .= $separator . _escape_and_quote($value); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $params_string = join( '', |
55
|
5
|
|
|
|
|
16
|
map { " -D$_=" . _escape_and_quote( $parameters->{$_} ); } sort keys(%$parameters) ); |
|
10
|
|
|
|
|
16
|
|
56
|
|
|
|
|
|
|
|
57
|
5
|
|
|
|
|
27
|
return "mvn$mvn_options_string " . join( ' ', @goals_and_phases ) . $params_string; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |