Skip to content

Commit 43a8dcb

Browse files
authored
chore: Add comprehensive GitHub Copilot instructions for jpm repository
1 parent a2001af commit 43a8dcb

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed

.github/copilot-instructions.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# jpm - Java Package Manager
2+
3+
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
4+
5+
jpm is a Java 11+ Maven-based command line tool for managing Maven dependencies in non-Maven/Gradle Java projects. It creates symbolic links to dependencies and manages app.yml configuration files.
6+
7+
## Working Effectively
8+
9+
### Bootstrap and Build the Repository
10+
- **CRITICAL**: Make mvnw executable first: `chmod +x mvnw`
11+
- Build and format code: `./mvnw spotless:apply clean install`
12+
- **NEVER CANCEL**: Takes ~35 seconds. Set timeout to 120+ seconds.
13+
- Quick rebuild after changes: `./mvnw clean verify`
14+
- **NEVER CANCEL**: Takes ~5 seconds. Set timeout to 60+ seconds.
15+
- CI build with release assembly: `./mvnw -B verify jreleaser:assemble -Prelease`
16+
- **NEVER CANCEL**: Takes ~32 seconds. Set timeout to 120+ seconds.
17+
18+
### Code Formatting and Validation
19+
- **ALWAYS** run formatting before committing: `./mvnw spotless:apply`
20+
- Takes ~2 seconds. Required for CI to pass.
21+
- Check formatting only: `./mvnw spotless:check`
22+
- **ALWAYS** run `./mvnw spotless:apply` before making any commits or the CI (.github/workflows/ci.yml) will fail.
23+
24+
### Testing and Running jpm
25+
- **No unit tests exist** - the Maven test phase skips with "No tests to run"
26+
- Run jpm using the binary distribution: `./target/binary/bin/jpm [commands]`
27+
- Run jpm using the CLI jar: `java -jar target/jpm-0.4.1-cli.jar [commands]`
28+
29+
## Validation
30+
31+
### Manual End-to-End Testing
32+
Always manually validate jpm functionality after making changes:
33+
34+
1. **Build the project**: `./mvnw spotless:apply clean install`
35+
2. **Test help**: `./target/binary/bin/jpm --help`
36+
3. **Test version**: `./target/binary/bin/jpm --version`
37+
4. **Create test directory**: `mkdir -p /tmp/jpm-test && cd /tmp/jpm-test`
38+
5. **Test copy functionality**: `[repo-path]/target/binary/bin/jpm copy com.github.lalyos:jfiglet:0.0.9`
39+
- Verify: Creates `deps/` directory with symlink to jar
40+
6. **Test install functionality**: `[repo-path]/target/binary/bin/jpm install com.github.lalyos:jfiglet:0.0.9`
41+
- Verify: Creates `app.yml` file with dependency entry
42+
7. **Test path command**: `[repo-path]/target/binary/bin/jpm path`
43+
- Verify: Outputs classpath to dependency jars
44+
8. **Test complete Java workflow**:
45+
```java
46+
// Create HelloWorld.java
47+
import com.github.lalyos.jfiglet.FigletFont;
48+
public class HelloWorld {
49+
public static void main(String[] args) throws Exception {
50+
System.out.println(FigletFont.convertOneLine("Hello, World!"));
51+
}
52+
}
53+
```
54+
- Run: `java -cp "deps/*" HelloWorld.java`
55+
- Verify: ASCII art output is displayed correctly
56+
57+
### Search Function Limitation
58+
- The `jpm search` command may fail with YAML parsing errors in some network environments
59+
- This is a known limitation, focus testing on copy, install, and path commands
60+
61+
## Build Artifacts and Outputs
62+
63+
### Key Build Products
64+
- `target/jpm-0.4.1.jar` - Main jar (not standalone)
65+
- `target/jpm-0.4.1-cli.jar` - Standalone executable jar (~5.8MB)
66+
- `target/binary/bin/jpm` - Executable shell script
67+
- `target/binary/lib/` - All dependency jars for distribution
68+
69+
### Distribution Files
70+
- **For users**: Use `target/jpm-0.4.1-cli.jar` or `target/binary/` directory
71+
- **For development**: Use `./target/binary/bin/jpm` for testing
72+
73+
## Repository Structure
74+
75+
### Key Directories
76+
- `src/main/java/org/codejive/jpm/` - Main source code
77+
- `Main.java` - CLI entry point with PicoCLI commands (Copy, Search, Install, PrintPath)
78+
- `Jpm.java` - Core business logic for artifact resolution and management
79+
- `util/` - Utility classes (FileUtils, ResolverUtils, SearchUtils, etc.)
80+
- `json/` - AppInfo class for app.yml file handling
81+
- `.github/workflows/ci.yml` - CI pipeline (build + jreleaser assembly)
82+
- `jreleaser.yml` - Release configuration
83+
- `pom.xml` - Maven build configuration
84+
85+
### Important Files
86+
- `pom.xml` - Maven configuration with Spotless formatting, Shade plugin, Appassembler
87+
- `app.yml` - Example dependency configuration (also created by jpm install)
88+
- `RELEASE.md` - Release process documentation
89+
- `.gitignore` - Excludes target/, deps/, IDE files
90+
91+
## Common Commands Reference
92+
93+
### Repository Root Files
94+
```bash
95+
ls -la
96+
# Key files: README.md, pom.xml, mvnw, jreleaser.yml, app.yml, src/
97+
```
98+
99+
### Maven Build Profiles
100+
- Default: Builds jar and CLI jar with binary distribution
101+
- `-Prelease`: Adds source and javadoc jars for releases
102+
- Spotless enforced in verify phase
103+
104+
### Java Version Requirements
105+
- **Java 11+** required for compilation and runtime
106+
- Main class: `org.codejive.jpm.Main`
107+
- Uses PicoCLI for command parsing, Maven Resolver for dependency resolution
108+
109+
## CI and Release Information
110+
- CI runs on Ubuntu with Java 11 (Temurin distribution)
111+
- Build command: `mvn -B verify jreleaser:assemble -Prelease`
112+
- Spotless formatting check is enforced - builds fail if formatting is incorrect
113+
- Release uses JReleaser for GitHub releases and Maven Central deployment
114+
115+
## Development Tips
116+
- Always run `./mvnw spotless:apply` before committing changes
117+
- The application has no unit tests - rely on manual validation scenarios
118+
- Search functionality may not work in all network environments, focus on core copy/install/path features
119+
- Build times are fast (~5-35 seconds) but always set generous timeouts to avoid premature cancellation
120+
- Use `chmod +x mvnw` if you get permission denied errors on fresh clones

mvnw

100644100755
File mode changed.

0 commit comments

Comments
 (0)