3
3
import io .github .mike10004 .crxtool .CrxPacker ;
4
4
import io .github .mike10004 .crxtool .KeyPairs ;
5
5
import io .github .mike10004 .crxtool .Zipping ;
6
- import org .apache .maven .execution .MavenSession ;
7
6
import org .apache .maven .plugin .AbstractMojo ;
8
7
import org .apache .maven .plugin .MojoExecutionException ;
9
8
import org .apache .maven .plugins .annotations .LifecyclePhase ;
10
9
import org .apache .maven .plugins .annotations .Mojo ;
11
10
import org .apache .maven .plugins .annotations .Parameter ;
12
- import org .apache .maven .project .MavenProject ;
13
11
14
12
import java .io .File ;
15
13
import java .io .FileInputStream ;
@@ -35,12 +33,6 @@ public class PackExtensionMojo extends AbstractMojo {
35
33
36
34
public static final String PROP_PREFIX = "crxtool." ;
37
35
38
- @ Parameter ( defaultValue = "${session}" , readonly = true )
39
- private MavenSession session ;
40
-
41
- @ Parameter ( defaultValue = "${project}" , readonly = true )
42
- private MavenProject project ;
43
-
44
36
/**
45
37
* Directory that contains extension source code and resource files. This
46
38
* is the parent directory of {@code manifest.json}.
@@ -59,7 +51,7 @@ public class PackExtensionMojo extends AbstractMojo {
59
51
* that is to be produced. If you set {@link #excludeHeader} to true, this
60
52
* should be changed to a zip file.
61
53
*/
62
- @ Parameter (defaultValue = "${project.build.directory}/${project.name }.crx" )
54
+ @ Parameter (defaultValue = "${project.build.directory}/${project.artifactId}-${project.version }.crx" )
63
55
private File outputFile ;
64
56
65
57
/**
@@ -84,6 +76,7 @@ public void execute() throws MojoExecutionException {
84
76
keyPair = KeyPairs .generateRsKeyPair (createRandom ());
85
77
}
86
78
Path extensionDir = sourceDirectory .toPath ();
79
+ com .google .common .io .Files .createParentDirs (outputFile );
87
80
if (isExcludeHeader ()) {
88
81
byte [] zipBytes = Zipping .zipDirectory (extensionDir , null );
89
82
java .nio .file .Files .write (outputFile .toPath (), zipBytes );
@@ -107,14 +100,6 @@ protected SecureRandom createRandom() {
107
100
return new SecureRandom ();
108
101
}
109
102
110
- public MavenSession getSession () {
111
- return session ;
112
- }
113
-
114
- public MavenProject getProject () {
115
- return project ;
116
- }
117
-
118
103
public File getSourceDirectory () {
119
104
return sourceDirectory ;
120
105
}
@@ -131,14 +116,6 @@ public boolean isExcludeHeader() {
131
116
return excludeHeader ;
132
117
}
133
118
134
- void setSession (MavenSession session ) {
135
- this .session = session ;
136
- }
137
-
138
- void setProject (MavenProject project ) {
139
- this .project = project ;
140
- }
141
-
142
119
public void setSourceDirectory (File sourceDirectory ) {
143
120
this .sourceDirectory = sourceDirectory ;
144
121
}
0 commit comments