maven-build-lifecycle
Use when working with Maven build phases, goals, profiles, or customizing the build process for Java projects.
What this skill does
# Maven Build Lifecycle
Master Maven's build lifecycle including phases, goals, profiles, and build customization for efficient Java project builds.
## Overview
Maven's build lifecycle is a well-defined sequence of phases that execute in order. Understanding the lifecycle is essential for effective build configuration and optimization.
## Default Lifecycle Phases
### Complete Phase Order
```
1. validate - Validate project structure
2. initialize - Initialize build state
3. generate-sources
4. process-sources
5. generate-resources
6. process-resources - Copy resources to output
7. compile - Compile source code
8. process-classes
9. generate-test-sources
10. process-test-sources
11. generate-test-resources
12. process-test-resources
13. test-compile - Compile test sources
14. process-test-classes
15. test - Run unit tests
16. prepare-package
17. package - Create JAR/WAR
18. pre-integration-test
19. integration-test - Run integration tests
20. post-integration-test
21. verify - Run verification checks
22. install - Install to local repo
23. deploy - Deploy to remote repo
```
### Common Phase Commands
```bash
# Compile only
mvn compile
# Compile and run tests
mvn test
# Create package
mvn package
# Install to local repository
mvn install
# Deploy to remote repository
mvn deploy
# Clean and build
mvn clean install
# Skip tests
mvn install -DskipTests
# Skip test compilation and execution
mvn install -Dmaven.test.skip=true
```
## Clean Lifecycle
```
1. pre-clean
2. clean - Delete target directory
3. post-clean
```
```bash
# Clean build artifacts
mvn clean
# Clean specific directory
mvn clean -DbuildDirectory=out
```
## Site Lifecycle
```
1. pre-site
2. site - Generate documentation
3. post-site
4. site-deploy - Deploy documentation
```
```bash
# Generate site
mvn site
# Generate and deploy site
mvn site-deploy
```
## Goals vs Phases
### Executing Phases
```bash
# Execute phase (runs all previous phases)
mvn package
```
### Executing Goals
```bash
# Execute specific goal
mvn compiler:compile
mvn surefire:test
mvn jar:jar
# Multiple goals
mvn dependency:tree compiler:compile
```
### Phase-to-Goal Bindings
```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<executions>
<execution>
<id>compile-sources</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
```
## Build Profiles
### Profile Definition
```xml
<profiles>
<profile>
<id>development</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<env>dev</env>
<skip.integration.tests>true</skip.integration.tests>
</properties>
</profile>
<profile>
<id>production</id>
<properties>
<env>prod</env>
<skip.integration.tests>false</skip.integration.tests>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<debug>false</debug>
<optimize>true</optimize>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
```
### Profile Activation
```bash
# Activate by name
mvn install -Pproduction
# Multiple profiles
mvn install -Pproduction,ci
# Deactivate profile
mvn install -P!development
```
### Activation Triggers
```xml
<profile>
<id>jdk17</id>
<activation>
<!-- Activate by JDK version -->
<jdk>17</jdk>
</activation>
</profile>
<profile>
<id>windows</id>
<activation>
<!-- Activate by OS -->
<os>
<family>windows</family>
</os>
</activation>
</profile>
<profile>
<id>ci</id>
<activation>
<!-- Activate by environment variable -->
<property>
<name>env.CI</name>
<value>true</value>
</property>
</activation>
</profile>
<profile>
<id>with-config</id>
<activation>
<!-- Activate by file existence -->
<file>
<exists>src/main/config/app.properties</exists>
</file>
</activation>
</profile>
```
## Resource Filtering
### Enable Filtering
```xml
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/*.properties</exclude>
<exclude>**/*.xml</exclude>
</excludes>
</resource>
</resources>
</build>
```
### Property Substitution
```properties
# application.properties
app.name=${project.name}
app.version=${project.version}
app.environment=${env}
build.timestamp=${maven.build.timestamp}
```
## Build Customization
### Source and Target Configuration
```xml
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
```
### Custom Source Directories
```xml
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
</build>
```
### Final Name and Output
```xml
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<directory>target</directory>
<outputDirectory>target/classes</outputDirectory>
<testOutputDirectory>target/test-classes</testOutputDirectory>
</build>
```
## Multi-Module Builds
### Reactor Options
```bash
# Build all modules
mvn install
# Build specific module and dependencies
mvn install -pl module-name -am
# Build dependents of a module
mvn install -pl module-name -amd
# Resume from specific module
mvn install -rf :module-name
# Build in parallel
mvn install -T 4
mvn install -T 1C # 1 thread per CPU core
```
### Module Order Control
```xml
<!-- parent/pom.xml -->
<modules>
<module>common</module>
<module>api</module>
<module>service</module>
<module>web</module>
</modules>
```
## Test Configuration
### Surefire Plugin (Unit Tests)
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
</includes>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
<parallel>methods</parallel>
<threadCount>4</threadCount>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
</configuration>
</plugin>
```
### Failsafe Plugin (Integration Tests)
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.