line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
17041
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
2
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Maven::Command; |
5
|
|
|
|
|
|
|
$Maven::Command::VERSION = '1.14'; |
6
|
|
|
|
|
|
|
# ABSTRACT: A command builder for mvn |
7
|
|
|
|
|
|
|
# PODNAME: Maven::Command |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
4
|
use Exporter qw(import); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
419
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
12
|
|
|
|
|
|
|
mvn_artifact_params |
13
|
|
|
|
|
|
|
mvn_command |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _escape_and_quote { |
17
|
12
|
|
|
12
|
|
13
|
my ($value) = @_; |
18
|
12
|
|
|
|
|
14
|
$value =~ s/\\/\\\\/g; |
19
|
12
|
|
|
|
|
11
|
$value =~ s/"/\\"/g; |
20
|
12
|
|
|
|
|
31
|
return "\"$value\""; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub mvn_artifact_params { |
24
|
1
|
|
|
1
|
1
|
1
|
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
|
48
|
my $mvn_options = ref( $_[0] ) eq 'HASH' ? shift : {}; |
41
|
5
|
100
|
|
|
|
15
|
my $parameters = ref( $_[$#_] ) eq 'HASH' ? pop : {}; |
42
|
5
|
|
|
|
|
10
|
my @goals_and_phases = @_; |
43
|
|
|
|
|
|
|
|
44
|
5
|
|
|
|
|
5
|
my $mvn_options_string = ''; |
45
|
5
|
|
|
|
|
20
|
foreach my $key ( sort keys(%$mvn_options) ) { |
46
|
5
|
|
|
|
|
9
|
$mvn_options_string .= " $key"; |
47
|
5
|
|
|
|
|
7
|
my $value = $mvn_options->{$key}; |
48
|
5
|
100
|
|
|
|
12
|
if ( defined($value) ) { |
49
|
2
|
50
|
|
|
|
6
|
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
|
|
|
|
|
18
|
map { " -D$_=" . _escape_and_quote( $parameters->{$_} ); } sort keys(%$parameters) ); |
|
10
|
|
|
|
|
23
|
|
56
|
|
|
|
|
|
|
|
57
|
5
|
|
|
|
|
33
|
return "mvn$mvn_options_string " . join( ' ', @goals_and_phases ) . $params_string; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |