-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
7 changed files
with
275 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6084Jsr250PluginTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package org.apache.maven.it; | ||
|
||
/* | ||
* 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 org.apache.maven.it.util.ResourceExtractor; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-6084">MNG-6084</a>. | ||
*/ | ||
public class MavenITmng6084Jsr250PluginTest | ||
extends AbstractMavenIntegrationTestCase | ||
{ | ||
|
||
private File testDir; | ||
|
||
public MavenITmng6084Jsr250PluginTest() | ||
{ | ||
super( "[3.5.1,)" ); | ||
} | ||
|
||
public void setUp() | ||
throws Exception | ||
{ | ||
super.setUp(); | ||
|
||
testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6084-jsr250-support" ); | ||
|
||
} | ||
|
||
protected void tearDown() | ||
throws Exception | ||
{ | ||
|
||
super.tearDown(); | ||
} | ||
|
||
public void testJsr250PluginExecution() | ||
throws Exception | ||
{ | ||
// | ||
// Build a plugin that uses JSR 250 annotations | ||
// | ||
Verifier v0 = newVerifier( testDir.getAbsolutePath(), "remote" ); | ||
v0.setAutoclean( false ); | ||
v0.deleteDirectory( "target" ); | ||
v0.deleteArtifacts( "org.apache.maven.its.mng6084" ); | ||
v0.executeGoal( "install" ); | ||
v0.verifyErrorFreeLog(); | ||
v0.resetStreams(); | ||
|
||
// | ||
// Execute the JSR 250 plugin | ||
// | ||
Verifier v1 = newVerifier( testDir.getAbsolutePath(), "remote" ); | ||
v1.setAutoclean( false ); | ||
v1.executeGoal( "org.apache.maven.its.mng6084:jsr250-maven-plugin:0.0.1-SNAPSHOT:hello" ); | ||
v1.verifyErrorFreeLog(); | ||
v1.resetStreams(); | ||
v1.verifyTextInLog( "Hello! I am a component using JSR 250 with @PostConstruct support" ); | ||
|
||
} | ||
|
||
} |
82 changes: 82 additions & 0 deletions
82
core-it-suite/src/test/resources/mng-6084-jsr250-support/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<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> | ||
|
||
<groupId>org.apache.maven.its.mng6084</groupId> | ||
<artifactId>jsr250-maven-plugin</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>maven-plugin</packaging> | ||
|
||
<name>JSR 250 Maven Plugin</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<mavenVersion>3.5.0</mavenVersion> | ||
<mavenPluginPluginVersion>3.2</mavenPluginPluginVersion> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>javax.inject</groupId> | ||
<artifactId>javax.inject</artifactId> | ||
<version>1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>jsr250-api</artifactId> | ||
<version>1.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-plugin-api</artifactId> | ||
<version>${mavenVersion}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.plugin-tools</groupId> | ||
<artifactId>maven-plugin-annotations</artifactId> | ||
<version>${mavenPluginPluginVersion}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-plugin-plugin</artifactId> | ||
<version>${mavenPluginPluginVersion}</version> | ||
<configuration> | ||
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>mojo-descriptor</id> | ||
<goals> | ||
<goal>descriptor</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>help-goal</id> | ||
<goals> | ||
<goal>helpmojo</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.sonatype.plugins</groupId> | ||
<artifactId>sisu-maven-plugin</artifactId> | ||
<version>1.1</version> | ||
<executions> | ||
<execution> | ||
<id>generate-index</id> | ||
<goals> | ||
<goal>main-index</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
60 changes: 60 additions & 0 deletions
60
...urces/mng-6084-jsr250-support/src/main/java/org/apache/maven/plugins/Jsr250Component.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.apache.maven.plugins; | ||
|
||
/* | ||
* 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 javax.inject.Named; | ||
import javax.inject.Singleton; | ||
import javax.annotation.PostConstruct; | ||
import javax.annotation.PreDestroy; | ||
|
||
@Named | ||
@Singleton | ||
public class Jsr250Component | ||
{ | ||
|
||
@PostConstruct | ||
public void init() | ||
{ | ||
System.out.println(); | ||
System.out.println(); | ||
System.out.println( "Hello! I am a component using JSR 250 with @PostConstruct support" ); | ||
System.out.println(); | ||
System.out.println(); | ||
} | ||
|
||
public void hello() | ||
{ | ||
System.out.println(); | ||
System.out.println(); | ||
System.out.println( "Hello! I am a component that is being used via constructor injection! That's right, I'm a JSR 330 badass." ); | ||
System.out.println(); | ||
System.out.println(); | ||
} | ||
|
||
@PreDestroy | ||
public void cleanup() | ||
{ | ||
System.out.println(); | ||
System.out.println(); | ||
System.out.println( "Hello! I am a component using JSR 250 with @PreDestroy support" ); | ||
System.out.println(); | ||
System.out.println(); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
.../resources/mng-6084-jsr250-support/src/main/java/org/apache/maven/plugins/Jsr250Mojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.apache.maven.plugins; | ||
|
||
/* | ||
* 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 javax.inject.Inject; | ||
|
||
import org.apache.maven.plugin.AbstractMojo; | ||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugins.annotations.LifecyclePhase; | ||
import org.apache.maven.plugins.annotations.Mojo; | ||
|
||
@Mojo( name = "hello", defaultPhase = LifecyclePhase.VALIDATE, requiresProject = false ) | ||
public class Jsr250Mojo | ||
extends AbstractMojo | ||
{ | ||
|
||
private Jsr250Component component; | ||
|
||
@Inject | ||
public Jsr250Mojo( Jsr250Component component ) | ||
{ | ||
this.component = component; | ||
} | ||
|
||
public void execute() | ||
throws MojoExecutionException | ||
{ | ||
// | ||
// Say hello to the world, my little constructor-injected component! | ||
// | ||
component.hello(); | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
core-it-support/maven-it-sample-archetype/src/main/resources/archetype-resources/.classpath
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
core-it-support/maven-it-sample-archetype/src/main/resources/archetype-resources/.project
This file was deleted.
Oops, something went wrong.