Package org.machanism.machai.mcp.maven
Class AbstractMCPServerMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.machanism.machai.mcp.maven.AbstractMCPServerMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
HttpStatelessServerMojo,HttpStreamableMcpServerMojo
public abstract class AbstractMCPServerMojo
extends org.apache.maven.plugin.AbstractMojo
Abstract base class for MCP server Maven plugin Mojos.
Provides common configuration and utility methods for managing environment variables and credentials required by the MCP server.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FileThe Maven module base directory.Map of environment variables for MCP server.protected intThe port on which the MCP server will run.protected org.apache.maven.project.MavenProjectThe current Maven project.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies environment parameters and credentials to the system properties.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
basedir
The Maven module base directory. -
project
@Parameter(readonly=true, defaultValue="${project}") protected org.apache.maven.project.MavenProject projectThe current Maven project. -
port
@Parameter(property="mcp.port", required=true) protected int portThe port on which the MCP server will run. -
params
Map of environment variables for MCP server.
-
-
Constructor Details
-
AbstractMCPServerMojo
public AbstractMCPServerMojo()Constructs a newAbstractMCPServerMojo.
-
-
Method Details
-
applyParameters
public void applyParameters() throws org.apache.maven.plugin.MojoExecutionExceptionApplies environment parameters and credentials to the system properties.Sets each parameter in
paramsas a system property if not already set. IfserverIdis specified, resolves credentials from Mavensettings.xmland sets them as system properties. Also applies any custom configuration properties found in the server configuration.- Throws:
org.apache.maven.plugin.MojoExecutionException- if the specified server ID is not found in Maven settings
-