Skip to content

Commit ce347c4

Browse files
committed
Alternative fix for the plugin issue that works in
older maven version.
1 parent 980e68c commit ce347c4

File tree

5 files changed

+55
-34
lines changed

5 files changed

+55
-34
lines changed

lbjava-examples/pom.xml

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,9 @@
1010
<artifactId>LBJavaExamples</artifactId>
1111

1212
<properties>
13-
<lbjava.mavenplugin.allFilesList>
14-
${project.basedir}/src/main/lbj/BadgesClassifier.lbj,
15-
${project.basedir}/src/main/lbj/SentimentClassifier.lbj,
16-
${project.basedir}/src/main/lbj/SetCover.lbj,
17-
${project.basedir}/src/main/lbj/EntityRelation.lbj,
18-
${project.basedir}/src/main/lbj/NewsGroupClassifier.lbj,
19-
${project.basedir}/src/main/lbj/SpamClassifier.lbj,
20-
${project.basedir}/src/main/lbj/RegressionClassifier.lbj
21-
</lbjava.mavenplugin.allFilesList>
13+
<lbjava.mavenplugin.defaultgoal>generate</lbjava.mavenplugin.defaultgoal>
2214
<!--The compile list is populated during profile selection-->
23-
<lbjava.mavenplugin.lbjCompileList></lbjava.mavenplugin.lbjCompileList>
15+
<lbjava.mavenplugin.lbjCompileFile></lbjava.mavenplugin.lbjCompileFile>
2416
</properties>
2517

2618
<repositories>
@@ -86,20 +78,31 @@
8678
<phase>generate-sources</phase>
8779
<goals>
8880
<goal>clean</goal>
89-
<goal>generate</goal>
81+
<goal>${lbjava.mavenplugin.defaultgoal}</goal>
9082
</goals>
9183
<configuration>
92-
<lbjavaInputFileList>${lbjava.mavenplugin.allFilesList}</lbjavaInputFileList>
84+
<lbjavaInputFileList>
85+
<param>${project.basedir}/src/main/lbj/BadgesClassifier.lbj</param>
86+
<param>${project.basedir}/src/main/lbj/SentimentClassifier.lbj</param>
87+
<param>${project.basedir}/src/main/lbj/SetCover.lbj</param>
88+
<param>${project.basedir}/src/main/lbj/EntityRelation.lbj</param>
89+
<param>${project.basedir}/src/main/lbj/NewsGroupClassifier.lbj</param>
90+
<param>${project.basedir}/src/main/lbj/SpamClassifier.lbj</param>
91+
<param>${project.basedir}/src/main/lbj/RegressionClassifier.lbj</param>
92+
</lbjavaInputFileList>
9393
</configuration>
9494
</execution>
9595
<execution>
96-
<id>lbjava-compile-examples</id>
96+
<id>optional-compile-step</id>
9797
<phase>generate-sources</phase>
9898
<goals>
99+
<goal>clean</goal>
99100
<goal>compile</goal>
100101
</goals>
101102
<configuration>
102-
<lbjavaInputFileList>${lbjava.mavenplugin.lbjCompileList}</lbjavaInputFileList>
103+
<lbjavaInputFileList>
104+
<param>${lbjava.mavenplugin.lbjCompileFile}</param>
105+
</lbjavaInputFileList>
103106
</configuration>
104107
</execution>
105108
</executions>
@@ -109,52 +112,53 @@
109112

110113
<profiles>
111114
<profile>
112-
<id>generate-train-examples</id>
115+
<id>train-all-examples</id>
113116
<properties>
114-
<lbjava.mavenplugin.lbjCompileList>${lbjava.mavenplugin.allFilesList}</lbjava.mavenplugin.lbjCompileList>
117+
<lbjava.mavenplugin.defaultgoal>compile</lbjava.mavenplugin.defaultgoal>
118+
<lbjava.mavenplugin.lbjCompileFile></lbjava.mavenplugin.lbjCompileFile>
115119
</properties>
116120
</profile>
117121
<!--example specific profile definitions follow-->
118122
<profile>
119-
<id>badges</id>
123+
<id>train-badges</id>
120124
<properties>
121-
<lbjava.mavenplugin.lbjCompileList>${project.basedir}/src/main/lbj/BadgesClassifier.lbj</lbjava.mavenplugin.lbjCompileList>
125+
<lbjava.mavenplugin.lbjCompileFile>${project.basedir}/src/main/lbj/BadgesClassifier.lbj</lbjava.mavenplugin.lbjCompileFile>
122126
</properties>
123127
</profile>
124128
<profile>
125-
<id>entity</id>
129+
<id>train-entity</id>
126130
<properties>
127-
<lbjava.mavenplugin.lbjCompileList>${project.basedir}/src/main/lbj/EntityRelation.lbj</lbjava.mavenplugin.lbjCompileList>
131+
<lbjava.mavenplugin.lbjCompileFile>${project.basedir}/src/main/lbj/EntityRelation.lbj</lbjava.mavenplugin.lbjCompileFile>
128132
</properties>
129133
</profile>
130134
<profile>
131-
<id>newsgroup</id>
135+
<id>train-newsgroup</id>
132136
<properties>
133-
<lbjava.mavenplugin.lbjCompileList>${project.basedir}/src/main/lbj/NewsGroupClassifier.lbj</lbjava.mavenplugin.lbjCompileList>
137+
<lbjava.mavenplugin.lbjCompileFile>${project.basedir}/src/main/lbj/NewsGroupClassifier.lbj</lbjava.mavenplugin.lbjCompileFile>
134138
</properties>
135139
</profile>
136140
<profile>
137-
<id>sentiment</id>
141+
<id>train-sentiment</id>
138142
<properties>
139-
<lbjava.mavenplugin.lbjCompileList>${project.basedir}/src/main/lbj/SentimentClassifier.lbj</lbjava.mavenplugin.lbjCompileList>
143+
<lbjava.mavenplugin.lbjCompileFile>${project.basedir}/src/main/lbj/SentimentClassifier.lbj</lbjava.mavenplugin.lbjCompileFile>
140144
</properties>
141145
</profile>
142146
<profile>
143-
<id>setcover</id>
147+
<id>train-setcover</id>
144148
<properties>
145-
<lbjava.mavenplugin.lbjCompileList>${project.basedir}/src/main/lbj/SetCover.lbj</lbjava.mavenplugin.lbjCompileList>
149+
<lbjava.mavenplugin.lbjCompileFile>${project.basedir}/src/main/lbj/SetCover.lbj</lbjava.mavenplugin.lbjCompileFile>
146150
</properties>
147151
</profile>
148152
<profile>
149-
<id>spam</id>
153+
<id>train-spam</id>
150154
<properties>
151-
<lbjava.mavenplugin.lbjCompileList>${project.basedir}/src/main/lbj/SpamClassifier.lbj</lbjava.mavenplugin.lbjCompileList>
155+
<lbjava.mavenplugin.lbjCompileFile>${project.basedir}/src/main/lbj/SpamClassifier.lbj</lbjava.mavenplugin.lbjCompileFile>
152156
</properties>
153157
</profile>
154158
<profile>
155-
<id>regression</id>
159+
<id>train-regression</id>
156160
<properties>
157-
<lbjava.mavenplugin.lbjCompileList>${project.basedir}/src/main/lbj/RegressionClassifier.lbj</lbjava.mavenplugin.lbjCompileList>
161+
<lbjava.mavenplugin.lbjCompileFile>${project.basedir}/src/main/lbj/RegressionClassifier.lbj</lbjava.mavenplugin.lbjCompileFile>
158162
</properties>
159163
</profile>
160164
</profiles>

lbjava-mvn-plugin/src/main/java/edu/illinois/cs/cogcomp/CleanMojo.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ public void execute() throws MojoExecutionException {
6868
List<String> fileList = Arrays.asList(lbjavaInputFileList);
6969
Collections.reverse(fileList);
7070
for (String lbjInputFile : fileList) {
71+
if (StringUtils.isEmpty(lbjInputFile)) {
72+
// making the optional-compile-step parameter happy.
73+
continue;
74+
}
75+
7176
getLog().info("Calling Java edu.illinois.cs.cogcomp.lbjava.Main with the -x flag (for cleaning)...");
7277
try {
73-
lbjInputFile = lbjInputFile.trim();
7478
// The -x flag makes all the difference.
7579
String[] args = new String[] { "java", "-cp", newpath, "edu.illinois.cs.cogcomp.lbjava.Main", "-x",
7680
"-d", dFlag, "-gsp", gspFlag, "-sourcepath", sourcepathFlag, lbjInputFile };

lbjava-mvn-plugin/src/main/java/edu/illinois/cs/cogcomp/CompileMojo.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,19 @@ public void execute() throws MojoExecutionException {
6868
new File(gspFlag).mkdirs();
6969

7070
for (String lbjInputFile : lbjavaInputFileList) {
71+
if (StringUtils.isEmpty(lbjInputFile)) {
72+
// making the optional-compile-step parameter happy.
73+
continue;
74+
}
75+
7176
getLog().info("Calling Java edu.illinois.cs.cogcomp.lbjava.Main...");
77+
78+
if (StringUtils.isEmpty(lbjInputFile)) {
79+
// making the optional-compile-parameter happy.
80+
continue;
81+
}
82+
7283
try {
73-
lbjInputFile = lbjInputFile.trim();
7484
String[] args = new String[] { "java", "-cp", newpath, "edu.illinois.cs.cogcomp.lbjava.Main",
7585
"-d", dFlag, "-gsp", gspFlag, "-sourcepath", sourcepathFlag, lbjInputFile };
7686

lbjava-mvn-plugin/src/main/java/edu/illinois/cs/cogcomp/GenerateMojo.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ public void execute() throws MojoExecutionException {
6868
new File(gspFlag).mkdirs();
6969

7070
for (String lbjInputFile : lbjavaInputFileList) {
71+
if (StringUtils.isEmpty(lbjInputFile)) {
72+
// making the optional-compile-step parameter happy.
73+
continue;
74+
}
75+
7176
getLog().info("Calling Java edu.illinois.cs.cogcomp.lbjava.Main...");
7277
try {
73-
lbjInputFile = lbjInputFile.trim();
7478
String[] args = new String[] { "java", "-cp", newpath, "edu.illinois.cs.cogcomp.lbjava.Main",
7579
"-c", "-d", dFlag, "-gsp", gspFlag, "-sourcepath", sourcepathFlag, lbjInputFile };
7680

lbjava/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
<groupId>gurobi</groupId>
3030
<artifactId>gurobi</artifactId>
3131
<version>5.0.1</version>
32-
<optional>true</optional>
3332
</dependency>
3433
<dependency>
3534
<groupId>nz.ac.waikato.cms.weka</groupId>

0 commit comments

Comments
 (0)