Skip to content

Commit 1214229

Browse files
mimnoclaude
andcommitted
Add binary ZIP distribution for easier end-user installation
Users can now download a self-contained ZIP from GitHub Releases instead of building from source. The ZIP includes pre-built JARs, launcher scripts, sample data, and stoplists. The CI workflow automatically attaches the ZIP when a release is published. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f43f320 commit 1214229

5 files changed

Lines changed: 100 additions & 6 deletions

File tree

.github/workflows/maven-publish.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
runs-on: ubuntu-latest
1818
permissions:
19-
contents: read
19+
contents: write
2020
packages: write
2121

2222
steps:
@@ -38,6 +38,12 @@ jobs:
3838
name: test-results
3939
path: target/surefire-reports/
4040

41+
- name: Upload Binary Distribution
42+
if: github.event_name == 'release'
43+
env:
44+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
run: gh release upload "${{ github.event.release.tag_name }}" target/mallet-*-bin.zip
46+
4147
- name: Publish to GitHub Packages using Apache Maven
4248
if: github.event_name == 'release'
4349
run: mvn --batch-mode deploy -P publish-on-github-packages -DskipTests

bin/mallet

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
malletdir=`dirname $0`
55
malletdir=`dirname $malletdir`
66

7-
cp=$malletdir/target/classes:$malletdir/target/dependency/*:$CLASSPATH
8-
#echo $cp
7+
# Support both source build (target/) and binary distribution (lib/)
8+
if [ -d "$malletdir/target/classes" ]; then
9+
cp=$malletdir/target/classes:$malletdir/target/dependency/*:$CLASSPATH
10+
else
11+
cp=$malletdir/lib/*:$CLASSPATH
12+
fi
913

1014
MEMORY="${MALLET_MEMORY:-1g}"
1115

@@ -15,7 +19,7 @@ shift
1519
help()
1620
{
1721
cat <<EOF
18-
Mallet 2.0 commands:
22+
Mallet 2.1.0 commands:
1923
2024
import-dir load the contents of a directory into mallet instances (one per file)
2125
import-file load a single file into mallet instances (one per line)

bin/mallet.bat

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ goto :eof
1010

1111
:gotMalletHome
1212

13-
set MALLET_CLASSPATH=%MALLET_HOME%\target\classes;%MALLET_HOME%\target\dependency\*
13+
rem Support both source build (target\) and binary distribution (lib\)
14+
if exist "%MALLET_HOME%\target\classes" (
15+
set MALLET_CLASSPATH=%MALLET_HOME%\target\classes;%MALLET_HOME%\target\dependency\*
16+
) else (
17+
set MALLET_CLASSPATH=%MALLET_HOME%\lib\*
18+
)
1419
set MALLET_MEMORY=1G
1520
set MALLET_ENCODING=UTF-8
1621

@@ -36,7 +41,7 @@ if "%CMD%"=="run" set CLASS=%1 & shift
3641

3742
if not "%CLASS%" == "" goto gotClass
3843

39-
echo Mallet 2.0 commands:
44+
echo Mallet 2.1.0 commands:
4045
echo import-dir load the contents of a directory into mallet instances (one per file)
4146
echo import-file load a single file into mallet instances (one per line)
4247
echo import-svmlight load a single SVMLight format data file into mallet instances (one per line)

pom.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,28 @@
184184
</executions>
185185
</plugin>
186186

187+
<!-- Binary distribution ZIP -->
188+
<plugin>
189+
<groupId>org.apache.maven.plugins</groupId>
190+
<artifactId>maven-assembly-plugin</artifactId>
191+
<version>3.7.1</version>
192+
<configuration>
193+
<descriptors>
194+
<descriptor>src/main/assembly/bin.xml</descriptor>
195+
</descriptors>
196+
<finalName>mallet-${project.version}</finalName>
197+
</configuration>
198+
<executions>
199+
<execution>
200+
<id>make-assembly</id>
201+
<phase>package</phase>
202+
<goals>
203+
<goal>single</goal>
204+
</goals>
205+
</execution>
206+
</executions>
207+
</plugin>
208+
187209
<!-- Unit tests -->
188210
<plugin>
189211
<groupId>org.apache.maven.plugins</groupId>

src/main/assembly/bin.xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 http://maven.apache.org/xsd/assembly-2.2.0.xsd">
4+
5+
<id>bin</id>
6+
<formats>
7+
<format>zip</format>
8+
</formats>
9+
10+
<includeBaseDirectory>true</includeBaseDirectory>
11+
12+
<!-- Include the main JAR and runtime dependencies in lib/ -->
13+
<dependencySets>
14+
<dependencySet>
15+
<outputDirectory>lib</outputDirectory>
16+
<useProjectArtifact>true</useProjectArtifact>
17+
<scope>runtime</scope>
18+
</dependencySet>
19+
</dependencySets>
20+
21+
<fileSets>
22+
<!-- bin/ scripts (with executable permission) -->
23+
<fileSet>
24+
<directory>bin</directory>
25+
<outputDirectory>bin</outputDirectory>
26+
<includes>
27+
<include>mallet</include>
28+
<include>mallet.bat</include>
29+
</includes>
30+
<fileMode>0755</fileMode>
31+
</fileSet>
32+
33+
<!-- Sample data for getting started -->
34+
<fileSet>
35+
<directory>sample-data</directory>
36+
<outputDirectory>sample-data</outputDirectory>
37+
</fileSet>
38+
39+
<!-- Stoplists -->
40+
<fileSet>
41+
<directory>stoplists</directory>
42+
<outputDirectory>stoplists</outputDirectory>
43+
</fileSet>
44+
45+
<!-- Top-level files -->
46+
<fileSet>
47+
<directory>.</directory>
48+
<outputDirectory>.</outputDirectory>
49+
<includes>
50+
<include>LICENSE</include>
51+
<include>README.md</include>
52+
<include>CHANGELOG.md</include>
53+
</includes>
54+
</fileSet>
55+
</fileSets>
56+
57+
</assembly>

0 commit comments

Comments
 (0)