[MPLUGIN-189] add java 5 annotations support to mark Mojo sources

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/branches/MPLUGIN-189@1331837 13f79535-47bb-0310-9956-ffa450edef68
master
Olivier Lamy 2012-04-28 21:23:10 +00:00
parent 587879842d
commit f4945e157a
8 changed files with 283 additions and 4 deletions

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.0-SNAPSHOT</version>
</parent>
<artifactId>maven-plugin-tools-annotations</artifactId>
<name>Maven Plugin Tools Annotations</name>
</project>

View File

@ -0,0 +1,40 @@
package org.apache.maven.tools.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Olivier Lamy
*/
@Documented
@Retention( RetentionPolicy.RUNTIME )
@Target( { ElementType.FIELD, ElementType.METHOD } )
@Inherited
public @interface Component
{
String role() default "";
String roleHint() default "";
}

View File

@ -0,0 +1,31 @@
package org.apache.maven.tools.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* @author Olivier Lamy
*/
public @interface Execute
{
LifecyclePhase phase() default LifecyclePhase.NONE;
String goal() default "";
String lifecycle() default "";
}

View File

@ -0,0 +1,63 @@
package org.apache.maven.tools.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Olivier Lamy
*/
@Documented
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.TYPE )
@Inherited
public @interface Goal
{
String name();
LifecyclePhase defaultPhase() default LifecyclePhase.NONE;
String requiresDependencyResolution() default "runtime";
String requiresDependencyCollection() default "runtime";
String instantiationStrategy() default "per-lookup";
String executionStrategy() default "once-per-session";
boolean requiresProject() default true;
boolean requiresReports() default false;
boolean aggregator() default false;
boolean requiresDirectInvocation() default false;
boolean requiresOnline() default false;
boolean inheritByDefault() default true;
String configurator() default "";
}

View File

@ -0,0 +1,74 @@
package org.apache.maven.tools.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* @author Olivier Lamy
*/
public enum LifecyclePhase
{
VALIDATE( "validate" ),
INITIALIZE( "initialize" ),
GENERATE_SOURCES( "generate-sources" ),
PROCESS_SOURCES( "process-sources" ),
GENERATE_RESOURCES( "generate-resources" ),
PROCESS_RESOURCES( "process-resources" ),
COMPILE( "compile" ),
PROCESS_CLASSES( "process-classes" ),
GENERATE_TEST_SOURCES( "generate-test-sources" ),
PROCESS_TEST_SOURCES( "process-test-sources" ),
GENERATE_TEST_RESOURCES( "generate-test-resources" ),
PROCESS_TEST_RESOURCES( "process-test-resources" ),
TEST_COMPILE( "test-compile" ),
PROCESS_TEST_CLASSES( "process-test-classes" ),
TEST( "test" ),
PREPARE_PACKAGE( "prepare-package" ),
PACKAGE( "package" ),
PRE_INTEGRATION_TEST( "pre-integration-test" ),
INTEGRATION_TEST( "integration-test" ),
POST_INTEGRATION_TEST( "post-integration-test" ),
VERIFY( "verify" ),
INSTALL( "install" ),
DEPLOY( "deploy" ),
PRE_CLEAN( "pre-clean" ),
CLEAN( "clean" ),
POST_CLEAN( "post-clean" ),
PRE_SITE( "pre-site" ),
SITE( "site" ),
POST_SITE( "post-site" ),
SITE_DEPLOY( "site-deploy" ),
NONE( "" );
private final String id;
LifecyclePhase( String id )
{
this.id = id;
}
public String id()
{
return this.id;
}
}

View File

@ -0,0 +1,35 @@
package org.apache.maven.tools.plugin.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* @author Olivier Lamy
*/
public @interface Parameter
{
String alias() default "";
String expression() default "";
String defaultValue() default "";
boolean required() default false;
boolean readonly() default false;
}

View File

@ -0,0 +1,18 @@
package org.apache.maven.tools.plugin.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Documented
@Inherited
@Retention( RUNTIME )
@Target( { TYPE } )
public @interface ThreadSafe
{
boolean value() default true;
}

12
pom.xml
View File

@ -1,5 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
@ -18,7 +17,6 @@
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@ -132,6 +130,7 @@
<module>maven-plugin-plugin</module>
<module>maven-plugin-tools-model</module>
<module>maven-plugin-tools-javadoc</module>
<module>maven-plugin-tools-annotations</module>
</modules>
<scm>
@ -176,6 +175,11 @@
<artifactId>maven-plugin-tools-java</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-annotations</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-beanshell</artifactId>
@ -309,4 +313,4 @@
</reporting>
</profile>
</profiles>
</project>
</project>