You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3.7 KiB

name description version
generate-project 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. 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 C:/Users/K/.claude/plugins/cache/claude-plugins-official/plugin-dev/9eae436aa296/scripts/create-structure.sh <project_dir> <base_package>

This creates:

project/
├── src/
│   ├── main/
│   │   ├── java/<package>/
│   │   ├── resources/
│   │   └── webapp/WEB-INF/
│   └── test/
│       ├── java/<package>/
│       └── resources/
├── lib/
└── .gitignore

Step 2: Generate pom.xml

bash C:/Users/K/.claude/plugins/cache/claude-plugins-official/plugin-dev/9eae436aa296/scripts/generate-pom.sh <project_dir> <group_id> <artifact_id>

The script auto-detects frameworks:

  • Spring
  • Struts
  • iBatis
  • Hibernate
  • Axis Web Services

Step 3: Move Decompiled Code

# 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

# 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

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:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

Struts

Add to src/main/webapp/WEB-INF/web.xml:

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

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