--- name: generate-project description: Generate Maven or Gradle project structure for Java projects. Use when user wants to create build configuration, organize source directories, or set up dependency management. version: 1.0.0 --- # Project Structure Generation This skill generates Maven/Gradle project structure and configuration. ## When to Use - User has decompiled code and needs proper project structure - User wants Maven/Gradle build configuration - User needs dependency management setup - User wants to organize code into standard directories ## Maven Project Generation ### Step 1: Create Directory Structure ```bash bash C:/Users/K/.claude/plugins/cache/claude-plugins-official/plugin-dev/9eae436aa296/scripts/create-structure.sh ``` This creates: ``` project/ ├── src/ │ ├── main/ │ │ ├── java// │ │ ├── resources/ │ │ └── webapp/WEB-INF/ │ └── test/ │ ├── java// │ └── resources/ ├── lib/ └── .gitignore ``` ### Step 2: Generate pom.xml ```bash bash C:/Users/K/.claude/plugins/cache/claude-plugins-official/plugin-dev/9eae436aa296/scripts/generate-pom.sh ``` The script auto-detects frameworks: - Spring - Struts - iBatis - Hibernate - Axis Web Services ### Step 3: Move Decompiled Code ```bash # Move decompiled Java files cp -r decompiled/src/* project/src/main/java/ # Move resources cp -r decompiled/resources/* project/src/main/resources/ # Move web files cp -r decompiled/webapp/* project/src/main/webapp/ ``` ### Step 4: Install Dependencies ```bash # Install Oracle JDBC manually mvn install:install-file \ -Dfile=lib/ojdbc14.jar \ -DgroupId=com.oracle \ -DartifactId=ojdbc14 \ -Dversion=10.2.0.4 \ -Dpackaging=jar # Resolve dependencies mvn dependency:resolve ``` ## Gradle Alternative For Gradle projects: ### build.gradle ```groovy plugins { id 'java' id 'war' } group = 'com.example' version = '1.0.0' sourceCompatibility = '1.8' targetCompatibility = '1.8' repositories { mavenCentral() flatDir { dirs 'lib' } } dependencies { implementation 'javax.servlet:javax.servlet-api:3.1.0' implementation 'org.springframework:spring-context:3.2.18.RELEASE' implementation 'org.springframework:spring-web:3.2.18.RELEASE' // Add more as detected testImplementation 'junit:junit:4.12' } war { archiveName = 'app.war' } ``` ## Framework-Specific Configuration ### Spring Add to `src/main/webapp/WEB-INF/web.xml`: ```xml contextConfigLocation /WEB-INF/applicationContext.xml org.springframework.web.context.ContextLoaderListener ``` ### Struts Add to `src/main/webapp/WEB-INF/web.xml`: ```xml struts2 org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter struts2 /* ``` ## Validation After generation: 1. Check pom.xml has all required dependencies 2. Verify directory structure matches package names 3. Ensure resources are in correct locations 4. Test compilation with `mvn compile` 5. Fix any missing dependencies ## Common Issues | Issue | Solution | |-------|----------| | Missing dependency | Add to pom.xml manually | | Package mismatch | Move files to correct directories | | Resource not found | Check src/main/resources | | Web config missing | Copy from original WEB-INF | | Oracle JDBC | Install manually to local repo |