New upstream version 3.6.4
Emmanuel Bourg
1 year, 7 months ago
23 | 23 | - maven-plugins |
24 | 24 | - maven-plugin-plugin |
25 | 25 | - maven |
26 | enabled_merge_buttons: | |
27 | squash: true | |
28 | merge: false | |
29 | rebase: true | |
30 | notifications: | |
31 | commits: commits@maven.apache.org | |
32 | issues: issues@maven.apache.org | |
33 | pullrequests: issues@maven.apache.org | |
34 | jira_options: link label comment |
0 | # Licensed to the Apache Software Foundation (ASF) under one | |
1 | # or more contributor license agreements. See the NOTICE file | |
2 | # distributed with this work for additional information | |
3 | # regarding copyright ownership. The ASF licenses this file | |
4 | # to you under the Apache License, Version 2.0 (the | |
5 | # "License"); you may not use this file except in compliance | |
6 | # with the License. You may obtain a copy of the License at | |
7 | # | |
8 | # http://www.apache.org/licenses/LICENSE-2.0 | |
9 | # | |
10 | # Unless required by applicable law or agreed to in writing, | |
11 | # software distributed under the License is distributed on an | |
12 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
13 | # KIND, either express or implied. See the License for the | |
14 | # specific language governing permissions and limitations | |
15 | # under the License. | |
16 | ||
17 | version: 2 | |
18 | updates: | |
19 | - package-ecosystem: "maven" | |
20 | directory: "/" | |
21 | schedule: | |
22 | interval: "daily" | |
23 | - package-ecosystem: "github-actions" | |
24 | directory: "/" | |
25 | schedule: | |
26 | interval: "daily" |
22 | 22 | <parent> |
23 | 23 | <artifactId>maven-plugin-tools</artifactId> |
24 | 24 | <groupId>org.apache.maven.plugin-tools</groupId> |
25 | <version>3.6.3</version> | |
25 | <version>3.6.4</version> | |
26 | 26 | </parent> |
27 | 27 | |
28 | 28 | <artifactId>maven-plugin-annotations</artifactId> |
22 | 22 | <parent> |
23 | 23 | <artifactId>maven-plugin-tools</artifactId> |
24 | 24 | <groupId>org.apache.maven.plugin-tools</groupId> |
25 | <version>3.6.3</version> | |
25 | <version>3.6.4</version> | |
26 | 26 | </parent> |
27 | 27 | |
28 | 28 | <groupId>org.apache.maven.plugins</groupId> |
41 | 41 | </prerequisites> |
42 | 42 | |
43 | 43 | <properties> |
44 | <doxiaVersion>1.9.1</doxiaVersion> | |
45 | <doxia-sitetoolsVersion>1.9.2</doxia-sitetoolsVersion> | |
44 | <doxiaVersion>1.11.1</doxiaVersion> | |
45 | <doxia-sitetoolsVersion>1.11.1</doxia-sitetoolsVersion> | |
46 | 46 | <it.debug>true</it.debug> |
47 | 47 | </properties> |
48 | 48 |
60 | 60 | <!-- dependency of org.apache.maven.plugin-tools:maven-plugin-tools-annotations:@project.version@:jar:tests --> |
61 | 61 | <groupId>junit</groupId> |
62 | 62 | <artifactId>junit</artifactId> |
63 | <version>4.12</version> | |
63 | <version>4.13.2</version> | |
64 | 64 | </dependency> |
65 | 65 | |
66 | 66 | <dependency> |
58 | 58 | <!-- dependency of org.apache.maven.plugin-tools:maven-plugin-tools-annotations:@project.version@:jar:tests --> |
59 | 59 | <groupId>junit</groupId> |
60 | 60 | <artifactId>junit</artifactId> |
61 | <version>4.12</version> | |
61 | <version>4.13.2</version> | |
62 | 62 | </dependency> |
63 | 63 | <dependency> |
64 | 64 | <groupId>org.apache.maven.plugin-tools</groupId> |
34 | 34 | |
35 | 35 | <dependencies> |
36 | 36 | <dependency> |
37 | <groupId>bsh</groupId> | |
37 | <groupId>org.apache-extras.beanshell</groupId> | |
38 | 38 | <artifactId>bsh</artifactId> |
39 | <version>1.3.0</version> | |
39 | <version>2.0b6</version> | |
40 | 40 | </dependency> |
41 | 41 | <dependency> |
42 | 42 | <groupId>org.apache.maven.plugin-tools</groupId> |
+1
-1
61 | 61 | <!-- dependency of org.apache.maven.plugin-tools:maven-plugin-tools-annotations:@project.version@:jar:tests --> |
62 | 62 | <groupId>junit</groupId> |
63 | 63 | <artifactId>junit</artifactId> |
64 | <version>4.12</version> | |
64 | <version>4.13.2</version> | |
65 | 65 | </dependency> |
66 | 66 | |
67 | 67 | <dependency> |
+121
-0
0 | package org.apache.maven.artifact.repository.metadata; | |
1 | ||
2 | /* | |
3 | * Licensed to the Apache Software Foundation (ASF) under one | |
4 | * or more contributor license agreements. See the NOTICE file | |
5 | * distributed with this work for additional information | |
6 | * regarding copyright ownership. The ASF licenses this file | |
7 | * to you under the Apache License, Version 2.0 (the | |
8 | * "License"); you may not use this file except in compliance | |
9 | * with the License. You may obtain a copy of the License at | |
10 | * | |
11 | * http://www.apache.org/licenses/LICENSE-2.0 | |
12 | * | |
13 | * Unless required by applicable law or agreed to in writing, | |
14 | * software distributed under the License is distributed on an | |
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
16 | * KIND, either express or implied. See the License for the | |
17 | * specific language governing permissions and limitations | |
18 | * under the License. | |
19 | */ | |
20 | ||
21 | import java.util.Iterator; | |
22 | import java.util.List; | |
23 | ||
24 | import org.apache.maven.artifact.repository.ArtifactRepository; | |
25 | ||
26 | /** | |
27 | * Metadata for the group directory of the repository. | |
28 | * Class copied from maven-compat for to remove dependency but keep compatibility with Maven 3 (and Nexus Staging | |
29 | * Plugin, see <a href="https://issues.apache.org/jira/browse/MPLUGIN-384">MPLUGIN-384</a>) | |
30 | * | |
31 | * @author <a href="mailto:brett@apache.org">Brett Porter</a> | |
32 | */ | |
33 | public class GroupRepositoryMetadata | |
34 | extends AbstractRepositoryMetadata | |
35 | { | |
36 | private final String groupId; | |
37 | ||
38 | public GroupRepositoryMetadata( String groupId ) | |
39 | { | |
40 | super( new Metadata() ); | |
41 | this.groupId = groupId; | |
42 | } | |
43 | ||
44 | public boolean storedInGroupDirectory() | |
45 | { | |
46 | return true; | |
47 | } | |
48 | ||
49 | public boolean storedInArtifactVersionDirectory() | |
50 | { | |
51 | return false; | |
52 | } | |
53 | ||
54 | public String getGroupId() | |
55 | { | |
56 | return groupId; | |
57 | } | |
58 | ||
59 | public String getArtifactId() | |
60 | { | |
61 | return null; | |
62 | } | |
63 | ||
64 | public String getBaseVersion() | |
65 | { | |
66 | return null; | |
67 | } | |
68 | ||
69 | public void addPluginMapping( String goalPrefix, | |
70 | String artifactId ) | |
71 | { | |
72 | addPluginMapping( goalPrefix, artifactId, artifactId ); | |
73 | } | |
74 | ||
75 | public void addPluginMapping( String goalPrefix, | |
76 | String artifactId, | |
77 | String name ) | |
78 | { | |
79 | List<Plugin> plugins = getMetadata().getPlugins(); | |
80 | boolean found = false; | |
81 | for ( Iterator<Plugin> i = plugins.iterator(); i.hasNext() && !found; ) | |
82 | { | |
83 | Plugin plugin = i.next(); | |
84 | if ( plugin.getPrefix().equals( goalPrefix ) ) | |
85 | { | |
86 | found = true; | |
87 | } | |
88 | } | |
89 | if ( !found ) | |
90 | { | |
91 | Plugin plugin = new Plugin(); | |
92 | plugin.setPrefix( goalPrefix ); | |
93 | plugin.setArtifactId( artifactId ); | |
94 | plugin.setName( name ); | |
95 | ||
96 | ||
97 | getMetadata().addPlugin( plugin ); | |
98 | } | |
99 | } | |
100 | ||
101 | public Object getKey() | |
102 | { | |
103 | return groupId; | |
104 | } | |
105 | ||
106 | public boolean isSnapshot() | |
107 | { | |
108 | return false; | |
109 | } | |
110 | ||
111 | public ArtifactRepository getRepository() | |
112 | { | |
113 | return null; | |
114 | } | |
115 | ||
116 | public void setRepository( ArtifactRepository remoteRepository ) | |
117 | { | |
118 | // intentionally blank | |
119 | } | |
120 | } |
+1
-0
20 | 20 | |
21 | 21 | import org.apache.maven.artifact.Artifact; |
22 | 22 | import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; |
23 | import org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata; | |
23 | 24 | import org.apache.maven.artifact.repository.metadata.Versioning; |
24 | 25 | import org.apache.maven.plugin.AbstractMojo; |
25 | 26 | import org.apache.maven.plugin.MojoExecutionException; |
+0
-122
0 | package org.apache.maven.plugin.plugin.metadata; | |
1 | ||
2 | /* | |
3 | * Licensed to the Apache Software Foundation (ASF) under one | |
4 | * or more contributor license agreements. See the NOTICE file | |
5 | * distributed with this work for additional information | |
6 | * regarding copyright ownership. The ASF licenses this file | |
7 | * to you under the Apache License, Version 2.0 (the | |
8 | * "License"); you may not use this file except in compliance | |
9 | * with the License. You may obtain a copy of the License at | |
10 | * | |
11 | * http://www.apache.org/licenses/LICENSE-2.0 | |
12 | * | |
13 | * Unless required by applicable law or agreed to in writing, | |
14 | * software distributed under the License is distributed on an | |
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
16 | * KIND, either express or implied. See the License for the | |
17 | * specific language governing permissions and limitations | |
18 | * under the License. | |
19 | */ | |
20 | ||
21 | import java.util.Iterator; | |
22 | import java.util.List; | |
23 | ||
24 | import org.apache.maven.artifact.repository.ArtifactRepository; | |
25 | import org.apache.maven.artifact.repository.metadata.AbstractRepositoryMetadata; | |
26 | import org.apache.maven.artifact.repository.metadata.Metadata; | |
27 | import org.apache.maven.artifact.repository.metadata.Plugin; | |
28 | ||
29 | /** | |
30 | * Metadata for the group directory of the repository. | |
31 | * | |
32 | * @author <a href="mailto:brett@apache.org">Brett Porter</a> | |
33 | */ | |
34 | public class GroupRepositoryMetadata | |
35 | extends AbstractRepositoryMetadata | |
36 | { | |
37 | private final String groupId; | |
38 | ||
39 | public GroupRepositoryMetadata( String groupId ) | |
40 | { | |
41 | super( new Metadata() ); | |
42 | this.groupId = groupId; | |
43 | } | |
44 | ||
45 | public boolean storedInGroupDirectory() | |
46 | { | |
47 | return true; | |
48 | } | |
49 | ||
50 | public boolean storedInArtifactVersionDirectory() | |
51 | { | |
52 | return false; | |
53 | } | |
54 | ||
55 | public String getGroupId() | |
56 | { | |
57 | return groupId; | |
58 | } | |
59 | ||
60 | public String getArtifactId() | |
61 | { | |
62 | return null; | |
63 | } | |
64 | ||
65 | public String getBaseVersion() | |
66 | { | |
67 | return null; | |
68 | } | |
69 | ||
70 | public void addPluginMapping( String goalPrefix, | |
71 | String artifactId ) | |
72 | { | |
73 | addPluginMapping( goalPrefix, artifactId, artifactId ); | |
74 | } | |
75 | ||
76 | public void addPluginMapping( String goalPrefix, | |
77 | String artifactId, | |
78 | String name ) | |
79 | { | |
80 | List<Plugin> plugins = getMetadata().getPlugins(); | |
81 | boolean found = false; | |
82 | for ( Iterator<Plugin> i = plugins.iterator(); i.hasNext() && !found; ) | |
83 | { | |
84 | Plugin plugin = i.next(); | |
85 | if ( plugin.getPrefix().equals( goalPrefix ) ) | |
86 | { | |
87 | found = true; | |
88 | } | |
89 | } | |
90 | if ( !found ) | |
91 | { | |
92 | Plugin plugin = new Plugin(); | |
93 | plugin.setPrefix( goalPrefix ); | |
94 | plugin.setArtifactId( artifactId ); | |
95 | plugin.setName( name ); | |
96 | ||
97 | ||
98 | getMetadata().addPlugin( plugin ); | |
99 | } | |
100 | } | |
101 | ||
102 | public Object getKey() | |
103 | { | |
104 | return groupId; | |
105 | } | |
106 | ||
107 | public boolean isSnapshot() | |
108 | { | |
109 | return false; | |
110 | } | |
111 | ||
112 | public ArtifactRepository getRepository() | |
113 | { | |
114 | return null; | |
115 | } | |
116 | ||
117 | public void setRepository( ArtifactRepository remoteRepository ) | |
118 | { | |
119 | // intentionally blank | |
120 | } | |
121 | } |
34 | 34 | +------------------ |
35 | 35 | <dependencies> |
36 | 36 | <dependency> |
37 | <groupId>bsh</groupId> | |
37 | <groupId>org.apache-extras.beanshell</groupId> | |
38 | 38 | <artifactId>bsh</artifactId> |
39 | <version>1.3.0</version> | |
39 | <version>2.0b6</version> | |
40 | 40 | </dependency> |
41 | 41 | <dependency> |
42 | 42 | <groupId>org.apache.maven</groupId> |
43 | 43 | <artifactId>maven-script-beanshell</artifactId> |
44 | <version>2.2.1</version> | |
44 | <version>3.6.4</version> | |
45 | 45 | </dependency> |
46 | 46 | </dependencies> |
47 | 47 |
21 | 21 | <parent> |
22 | 22 | <groupId>org.apache.maven.plugin-tools</groupId> |
23 | 23 | <artifactId>maven-plugin-tools</artifactId> |
24 | <version>3.6.3</version> | |
24 | <version>3.6.4</version> | |
25 | 25 | </parent> |
26 | 26 | |
27 | 27 | <artifactId>maven-plugin-tools-annotations</artifactId> |
73 | 73 | <dependency> |
74 | 74 | <groupId>org.codehaus.plexus</groupId> |
75 | 75 | <artifactId>plexus-archiver</artifactId> |
76 | <version>4.2.5</version><!-- Java 7 --> | |
76 | 77 | </dependency> |
77 | 78 | |
78 | 79 | <dependency> |
88 | 89 | <dependency> |
89 | 90 | <groupId>org.codehaus.plexus</groupId> |
90 | 91 | <artifactId>plexus-compiler-manager</artifactId> |
91 | <version>1.8.6</version> | |
92 | <exclusions> | |
93 | <exclusion> | |
94 | <groupId>org.codehaus.plexus</groupId> | |
95 | <artifactId>plexus-component-api</artifactId> | |
96 | </exclusion> | |
97 | </exclusions> | |
92 | <version>2.8.8</version><!-- Java 7 --> | |
98 | 93 | <scope>test</scope> |
99 | 94 | </dependency> |
100 | 95 | <dependency> |
108 | 103 | <scope>test</scope> |
109 | 104 | </dependency> |
110 | 105 | <dependency> |
111 | <groupId>org.easytesting</groupId> | |
112 | <artifactId>fest-assert</artifactId> | |
113 | <version>1.4</version> | |
106 | <groupId>org.assertj</groupId> | |
107 | <artifactId>assertj-core</artifactId> | |
108 | <version>2.9.1</version><!-- Java 7 --> | |
114 | 109 | <scope>test</scope> |
115 | 110 | </dependency> |
116 | 111 | </dependencies> |
+5
-4
28 | 28 | import org.apache.maven.tools.plugin.extractor.annotations.scanner.MojoAnnotationsScanner; |
29 | 29 | import org.apache.maven.tools.plugin.extractor.annotations.scanner.MojoAnnotationsScannerRequest; |
30 | 30 | import org.codehaus.plexus.PlexusTestCase; |
31 | import org.fest.assertions.Assertions; | |
32 | 31 | |
33 | 32 | import java.io.File; |
34 | 33 | import java.util.Arrays; |
35 | 34 | import java.util.Collection; |
36 | 35 | import java.util.Collections; |
37 | 36 | import java.util.Map; |
37 | ||
38 | import static org.assertj.core.api.Assertions.assertThat; | |
38 | 39 | |
39 | 40 | /** |
40 | 41 | * @author Olivier Lamy |
56 | 57 | |
57 | 58 | System.out.println( "mojoAnnotatedClasses:" + mojoAnnotatedClasses ); |
58 | 59 | |
59 | Assertions.assertThat( mojoAnnotatedClasses ).isNotNull().isNotEmpty().hasSize( 1 ); | |
60 | assertThat( mojoAnnotatedClasses ).isNotNull().isNotEmpty().hasSize( 1 ); | |
60 | 61 | |
61 | 62 | MojoAnnotatedClass mojoAnnotatedClass = mojoAnnotatedClasses.values().iterator().next(); |
62 | 63 | |
77 | 78 | assertEquals( LifecyclePhase.PACKAGE, execute.phase() ); |
78 | 79 | |
79 | 80 | Collection<ComponentAnnotationContent> components = mojoAnnotatedClass.getComponents().values(); |
80 | Assertions.assertThat( components ).isNotNull().isNotEmpty().hasSize( 2 ); | |
81 | assertThat( components ).isNotNull().isNotEmpty().hasSize( 2 ); | |
81 | 82 | |
82 | 83 | Collection<ParameterAnnotationContent> parameters = mojoAnnotatedClass.getParameters().values(); |
83 | Assertions.assertThat( parameters ).isNotNull().isNotEmpty().hasSize( 2 ).contains( | |
84 | assertThat( parameters ).isNotNull().isNotEmpty().hasSize( 2 ).contains( | |
84 | 85 | new ParameterAnnotationContent( "bar", null, "thebar", "coolbar", true, false, String.class.getName() ), |
85 | 86 | new ParameterAnnotationContent( "beer", null, "thebeer", "coolbeer", false, false, |
86 | 87 | String.class.getName() ) ); |
24 | 24 | <parent> |
25 | 25 | <groupId>org.apache.maven.plugin-tools</groupId> |
26 | 26 | <artifactId>maven-plugin-tools</artifactId> |
27 | <version>3.6.3</version> | |
27 | <version>3.6.4</version> | |
28 | 28 | </parent> |
29 | 29 | |
30 | 30 | <artifactId>maven-plugin-tools-api</artifactId> |
24 | 24 | <parent> |
25 | 25 | <groupId>org.apache.maven.plugin-tools</groupId> |
26 | 26 | <artifactId>maven-plugin-tools</artifactId> |
27 | <version>3.6.3</version> | |
27 | <version>3.6.4</version> | |
28 | 28 | </parent> |
29 | 29 | |
30 | 30 | <artifactId>maven-plugin-tools-generators</artifactId> |
24 | 24 | <parent> |
25 | 25 | <groupId>org.apache.maven.plugin-tools</groupId> |
26 | 26 | <artifactId>maven-plugin-tools</artifactId> |
27 | <version>3.6.3</version> | |
27 | <version>3.6.4</version> | |
28 | 28 | </parent> |
29 | 29 | |
30 | 30 | <artifactId>maven-plugin-tools-java</artifactId> |
74 | 74 | <dependency> |
75 | 75 | <groupId>xmlunit</groupId> |
76 | 76 | <artifactId>xmlunit</artifactId> |
77 | <version>1.3</version> | |
77 | <version>1.6</version> | |
78 | 78 | <scope>test</scope> |
79 | 79 | </dependency> |
80 | 80 | </dependencies> |
24 | 24 | <parent> |
25 | 25 | <groupId>org.apache.maven.plugin-tools</groupId> |
26 | 26 | <artifactId>maven-script</artifactId> |
27 | <version>3.6.3</version> | |
27 | <version>3.6.4</version> | |
28 | 28 | </parent> |
29 | 29 | |
30 | 30 | <artifactId>maven-plugin-tools-ant</artifactId> |
24 | 24 | <parent> |
25 | 25 | <groupId>org.apache.maven.plugin-tools</groupId> |
26 | 26 | <artifactId>maven-script</artifactId> |
27 | <version>3.6.3</version> | |
27 | <version>3.6.4</version> | |
28 | 28 | </parent> |
29 | 29 | |
30 | 30 | <artifactId>maven-plugin-tools-beanshell</artifactId> |
55 | 55 | |
56 | 56 | <!-- misc --> |
57 | 57 | <dependency> |
58 | <groupId>org.beanshell</groupId> | |
58 | <groupId>org.apache-extras.beanshell</groupId> | |
59 | 59 | <artifactId>bsh</artifactId> |
60 | <version>1.3.0</version> | |
60 | <version>2.0b6</version> | |
61 | 61 | </dependency> |
62 | 62 | </dependencies> |
63 | 63 |
24 | 24 | <parent> |
25 | 25 | <groupId>org.apache.maven.plugin-tools</groupId> |
26 | 26 | <artifactId>maven-script</artifactId> |
27 | <version>3.6.3</version> | |
27 | <version>3.6.4</version> | |
28 | 28 | </parent> |
29 | 29 | |
30 | 30 | <artifactId>maven-plugin-tools-model</artifactId> |
22 | 22 | <parent> |
23 | 23 | <groupId>org.apache.maven.plugin-tools</groupId> |
24 | 24 | <artifactId>maven-script</artifactId> |
25 | <version>3.6.3</version> | |
25 | <version>3.6.4</version> | |
26 | 26 | </parent> |
27 | 27 | |
28 | 28 | <artifactId>maven-script-ant</artifactId> |
59 | 59 | <dependency> |
60 | 60 | <groupId>org.codehaus.plexus</groupId> |
61 | 61 | <artifactId>plexus-archiver</artifactId> |
62 | <version>4.2.5</version><!-- Java 7 --> | |
62 | 63 | </dependency> |
63 | 64 | <dependency> |
64 | 65 | <groupId>org.apache.maven</groupId> |
+2
-2
33 | 33 | import org.apache.tools.ant.PropertyHelper; |
34 | 34 | import org.apache.tools.ant.types.Path; |
35 | 35 | import org.codehaus.plexus.archiver.ArchiverException; |
36 | import org.codehaus.plexus.archiver.UnArchiver; | |
37 | 36 | import org.codehaus.plexus.archiver.zip.ZipUnArchiver; |
38 | 37 | import org.codehaus.plexus.component.MapOrientedComponent; |
39 | 38 | import org.codehaus.plexus.component.configurator.ComponentConfigurationException; |
203 | 202 | |
204 | 203 | try |
205 | 204 | { |
206 | UnArchiver ua = new ZipUnArchiver( pluginJar ); | |
205 | ZipUnArchiver ua = new ZipUnArchiver( pluginJar ); | |
206 | ua.enableLogging( logger ); | |
207 | 207 | |
208 | 208 | ua.extract( resourcesPath, outputDirectory ); |
209 | 209 | } |
+49
-87
86 | 86 | { |
87 | 87 | String pluginXml = "META-INF/maven/plugin-2.1.xml"; |
88 | 88 | |
89 | List<String> messages = run( pluginXml, true ); | |
90 | ||
91 | assertPresence( messages, "Unpacked Ant build scripts (in Maven build directory).", false ); | |
92 | assertPresence( messages, "Maven parameter expression evaluator for Ant properties.", false ); | |
93 | assertPresence( messages, "Maven standard project-based classpath references.", false ); | |
94 | assertPresence( messages, "Maven standard plugin-based classpath references.", false ); | |
95 | assertPresence( messages, | |
96 | "Maven project, session, mojo-execution, or path-translation parameter information is", false ); | |
97 | assertPresence( messages, "maven-script-ant < 2.1.0, or used maven-plugin-tools-ant < 2.2 during release", | |
98 | false ); | |
89 | List<String> messages = run( pluginXml ); | |
90 | ||
91 | assertPresence( messages, "Unpacked Ant build scripts (in Maven build directory)." ); | |
92 | assertPresence( messages, "Maven parameter expression evaluator for Ant properties." ); | |
93 | assertPresence( messages, "Maven standard project-based classpath references." ); | |
94 | assertPresence( messages, "Maven standard plugin-based classpath references." ); | |
95 | assertPresence( messages, "Maven project, session, mojo-execution, or path-translation parameter information is" ); | |
96 | assertPresence( messages, "maven-script-ant < 2.1.0, or used maven-plugin-tools-ant < 2.2 during release" ); | |
99 | 97 | |
100 | 98 | ArgumentCaptor<BuildEvent> buildEvent = ArgumentCaptor.forClass(BuildEvent.class); |
101 | 99 | verify( buildListener, atLeastOnce() ).messageLogged( buildEvent.capture() ); |
105 | 103 | assertThat( buildEvent.getValue().getMessage(), endsWith( ".test.jar" ) ); |
106 | 104 | } |
107 | 105 | |
108 | @Test | |
109 | public void test20StylePlugin() | |
110 | throws PlexusConfigurationException, IOException, ComponentInstantiationException, MojoExecutionException, | |
111 | ComponentConfigurationException, ArchiverException, URISyntaxException | |
112 | { | |
113 | String pluginXml = "META-INF/maven/plugin-2.0.xml"; | |
114 | ||
115 | List<String> messages = run( pluginXml, false ); | |
116 | ||
117 | assertPresence( messages, "Unpacked Ant build scripts (in Maven build directory).", true ); | |
118 | assertPresence( messages, "Maven parameter expression evaluator for Ant properties.", true ); | |
119 | assertPresence( messages, "Maven standard project-based classpath references.", true ); | |
120 | assertPresence( messages, "Maven standard plugin-based classpath references.", true ); | |
121 | assertPresence( messages, | |
122 | "Maven project, session, mojo-execution, or path-translation parameter information is", true ); | |
123 | assertPresence( messages, "maven-script-ant < 2.1.0, or used maven-plugin-tools-ant < 2.2 during release", true ); | |
124 | ||
125 | ArgumentCaptor<BuildEvent> buildEvent = ArgumentCaptor.forClass(BuildEvent.class); | |
126 | verify( buildListener, atLeastOnce() ).messageLogged( buildEvent.capture() ); | |
127 | ||
128 | // last message | |
129 | assertThat( buildEvent.getValue().getMessage(), startsWith( "plugin classpath is: " ) ); | |
130 | assertThat( buildEvent.getValue().getMessage(), endsWith( "path-is-missing" ) ); | |
131 | } | |
132 | ||
133 | private void assertPresence( List<String> messages, String test, boolean shouldBePresent ) | |
106 | private void assertPresence( List<String> messages, String test ) | |
134 | 107 | { |
135 | 108 | for ( String message : messages ) |
136 | 109 | { |
137 | 110 | if ( message.contains( test ) ) |
138 | 111 | { |
139 | if ( !shouldBePresent ) | |
140 | { | |
141 | fail( "Test string: '" + test + "' was found in output, but SHOULD NOT BE THERE." ); | |
142 | } | |
112 | fail( "Test string: '" + test + "' was found in output, but SHOULD NOT BE THERE." ); | |
143 | 113 | return; |
144 | 114 | } |
145 | 115 | } |
146 | ||
147 | if ( shouldBePresent ) | |
148 | { | |
149 | fail( "Test string: '" + test + "' was NOT found in output, but SHOULD BE THERE." ); | |
150 | } | |
151 | } | |
152 | ||
153 | private List<String> run( String pluginXml, boolean includeImplied ) | |
116 | } | |
117 | ||
118 | private List<String> run( String pluginXml ) | |
154 | 119 | throws PlexusConfigurationException, IOException, ComponentInstantiationException, MojoExecutionException, |
155 | 120 | ComponentConfigurationException, ArchiverException, URISyntaxException |
156 | 121 | { |
184 | 149 | Artifact artifact = mock( Artifact.class ); |
185 | 150 | PathTranslator pt = mock( PathTranslator.class ); |
186 | 151 | |
187 | if ( includeImplied ) | |
188 | { | |
189 | File pluginXmlFile = Paths.get( resource.toURI() ).toFile(); | |
190 | ||
191 | File jarFile = File.createTempFile( "AntMojoWrapperTest.", ".test.jar" ); | |
192 | jarFile.deleteOnExit(); | |
193 | ||
194 | JarArchiver archiver = new JarArchiver(); | |
195 | archiver.enableLogging( new ConsoleLogger( Logger.LEVEL_ERROR, "archiver" ) ); | |
196 | archiver.setDestFile( jarFile ); | |
197 | archiver.addFile( pluginXmlFile, pluginXml ); | |
198 | archiver.createArchive(); | |
199 | ||
200 | when( artifact.getFile() ).thenReturn( jarFile ); | |
201 | ||
202 | Model model = new Model(); | |
203 | ||
204 | Build build = new Build(); | |
205 | build.setDirectory( "target" ); | |
206 | ||
207 | model.setBuild( build ); | |
208 | ||
209 | MavenProject project = new MavenProject( model ); | |
210 | project.setFile( new File( "pom.xml" ).getAbsoluteFile() ); | |
211 | ||
212 | pd.setPluginArtifact( artifact ); | |
213 | pd.setArtifacts( Collections.singletonList( artifact ) ); | |
214 | ||
215 | config.put( "project", project ); | |
216 | config.put( "session", new MavenSession( null, null, null, null, null, null, null, null, null, null ) ); | |
217 | config.put( "mojoExecution", new MojoExecution( md ) ); | |
218 | ||
219 | ComponentRequirement cr = new ComponentRequirement(); | |
220 | cr.setRole( PathTranslator.class.getName() ); | |
221 | ||
222 | wrapper.addComponentRequirement( cr, pt ); | |
223 | } | |
152 | File pluginXmlFile = Paths.get( resource.toURI() ).toFile(); | |
153 | ||
154 | File jarFile = File.createTempFile( "AntMojoWrapperTest.", ".test.jar" ); | |
155 | jarFile.deleteOnExit(); | |
156 | ||
157 | JarArchiver archiver = new JarArchiver(); | |
158 | archiver.enableLogging( new ConsoleLogger( Logger.LEVEL_ERROR, "archiver" ) ); | |
159 | archiver.setDestFile( jarFile ); | |
160 | archiver.addFile( pluginXmlFile, pluginXml ); | |
161 | archiver.createArchive(); | |
162 | ||
163 | when( artifact.getFile() ).thenReturn( jarFile ); | |
164 | ||
165 | Model model = new Model(); | |
166 | ||
167 | Build build = new Build(); | |
168 | build.setDirectory( "target" ); | |
169 | ||
170 | model.setBuild( build ); | |
171 | ||
172 | MavenProject project = new MavenProject( model ); | |
173 | project.setFile( new File( "pom.xml" ).getAbsoluteFile() ); | |
174 | ||
175 | pd.setPluginArtifact( artifact ); | |
176 | pd.setArtifacts( Collections.singletonList( artifact ) ); | |
177 | ||
178 | config.put( "project", project ); | |
179 | config.put( "session", new MavenSession( null, null, null, null, null, null, null, null, null, null ) ); | |
180 | config.put( "mojoExecution", new MojoExecution( md ) ); | |
181 | ||
182 | ComponentRequirement cr = new ComponentRequirement(); | |
183 | cr.setRole( PathTranslator.class.getName() ); | |
184 | ||
185 | wrapper.addComponentRequirement( cr, pt ); | |
224 | 186 | |
225 | 187 | wrapper.setComponentConfiguration( config ); |
226 | 188 | |
250 | 212 | messages.addAll( tbl.messages ); |
251 | 213 | } |
252 | 214 | |
253 | messages.add( new String( baos.toByteArray() ) ); | |
215 | messages.add( baos.toString() ); | |
254 | 216 | |
255 | 217 | return messages; |
256 | 218 | } |
258 | 220 | private static final class TestBuildListener |
259 | 221 | implements BuildListener |
260 | 222 | { |
261 | private List<String> messages = new ArrayList<>(); | |
223 | private final List<String> messages = new ArrayList<>(); | |
262 | 224 | |
263 | 225 | public void buildFinished( BuildEvent arg0 ) |
264 | 226 | { |
0 | <?xml version='1.0'?> | |
1 | <!-- | |
2 | Licensed to the Apache Software Foundation (ASF) under one | |
3 | or more contributor license agreements. See the NOTICE file | |
4 | distributed with this work for additional information | |
5 | regarding copyright ownership. The ASF licenses this file | |
6 | to you under the Apache License, Version 2.0 (the | |
7 | "License"); you may not use this file except in compliance | |
8 | with the License. You may obtain a copy of the License at | |
9 | ||
10 | http://www.apache.org/licenses/LICENSE-2.0 | |
11 | ||
12 | Unless required by applicable law or agreed to in writing, | |
13 | software distributed under the License is distributed on an | |
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | KIND, either express or implied. See the License for the | |
16 | specific language governing permissions and limitations | |
17 | under the License. | |
18 | --> | |
19 | ||
20 | <plugin> | |
21 | <description>Test Plugin</description> | |
22 | <groupId>org.myplugin</groupId> | |
23 | <artifactId>my-plugin</artifactId> | |
24 | <version>1</version> | |
25 | <goalPrefix>myplugin</goalPrefix> | |
26 | <isolatedRealm>false</isolatedRealm> | |
27 | <inheritedByDefault>true</inheritedByDefault> | |
28 | <mojos> | |
29 | <mojo> | |
30 | <goal>test</goal> | |
31 | <description>Build a JAR from the current project.</description> | |
32 | <requiresDirectInvocation>false</requiresDirectInvocation> | |
33 | <requiresProject>false</requiresProject> | |
34 | <requiresReports>false</requiresReports> | |
35 | <aggregator>false</aggregator> | |
36 | <requiresOnline>false</requiresOnline> | |
37 | <inheritedByDefault>true</inheritedByDefault> | |
38 | <implementation>test.build.xml:test</implementation> | |
39 | <language>ant</language> | |
40 | <instantiationStrategy>per-lookup</instantiationStrategy> | |
41 | <executionStrategy>once-per-session</executionStrategy> | |
42 | <parameters> | |
43 | <parameter> | |
44 | <name>basedir</name> | |
45 | <required>true</required> | |
46 | <editable>false</editable> | |
47 | <type>java.io.File</type> | |
48 | </parameter> | |
49 | <parameter> | |
50 | <name>messageLevel</name> | |
51 | <required>true</required> | |
52 | <editable>false</editable> | |
53 | <type>java.lang.String</type> | |
54 | </parameter> | |
55 | </parameters> | |
56 | <configuration> | |
57 | <basedir implementation="java.io.File">${basedir}</basedir> | |
58 | <messageLevel implementation="java.lang.String">${messageLevel}</messageLevel> | |
59 | </configuration> | |
60 | </mojo> | |
61 | </mojos> | |
62 | </plugin>⏎ |
22 | 22 | <parent> |
23 | 23 | <groupId>org.apache.maven.plugin-tools</groupId> |
24 | 24 | <artifactId>maven-script</artifactId> |
25 | <version>3.6.3</version> | |
25 | <version>3.6.4</version> | |
26 | 26 | </parent> |
27 | 27 | |
28 | 28 | <artifactId>maven-script-beanshell</artifactId> |
47 | 47 | </exclusions> |
48 | 48 | </dependency> |
49 | 49 | <dependency> |
50 | <groupId>bsh</groupId> | |
50 | <groupId>org.apache-extras.beanshell</groupId> | |
51 | 51 | <artifactId>bsh</artifactId> |
52 | <version>1.3.0</version> | |
52 | <version>2.0b6</version> | |
53 | 53 | </dependency> |
54 | 54 | </dependencies> |
55 | 55 | </project> |
22 | 22 | <parent> |
23 | 23 | <groupId>org.apache.maven.plugin-tools</groupId> |
24 | 24 | <artifactId>maven-plugin-tools</artifactId> |
25 | <version>3.6.3</version> | |
25 | <version>3.6.4</version> | |
26 | 26 | </parent> |
27 | 27 | |
28 | 28 | <artifactId>maven-script</artifactId> |
28 | 28 | |
29 | 29 | <groupId>org.apache.maven.plugin-tools</groupId> |
30 | 30 | <artifactId>maven-plugin-tools</artifactId> |
31 | <version>3.6.3</version> | |
31 | <version>3.6.4</version> | |
32 | 32 | <packaging>pom</packaging> |
33 | 33 | |
34 | 34 | <name>Maven Plugin Tools</name> |
71 | 71 | <connection>scm:git:https://gitbox.apache.org/repos/asf/maven-plugin-tools.git</connection> |
72 | 72 | <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-plugin-tools.git</developerConnection> |
73 | 73 | <url>https://github.com/apache/maven-plugin-tools/tree/${project.scm.tag}</url> |
74 | <tag>maven-plugin-tools-3.6.3</tag> | |
74 | <tag>maven-plugin-tools-3.6.4</tag> | |
75 | 75 | </scm> |
76 | 76 | <issueManagement> |
77 | 77 | <system>jira</system> |
93 | 93 | <javaVersion>7</javaVersion> |
94 | 94 | <pluginTestingHarnessVersion>3.3.0</pluginTestingHarnessVersion> |
95 | 95 | <mavenVersion>3.2.5</mavenVersion> |
96 | <antVersion>1.7.1</antVersion> | |
96 | <antVersion>1.9.16</antVersion> | |
97 | 97 | <sisuVersion>0.3.5</sisuVersion> |
98 | 98 | <mavenInvokerPluginVersion>3.2.2</mavenInvokerPluginVersion> |
99 | 99 | <maven.site.path>plugin-tools-archives/plugin-tools-LATEST</maven.site.path> |
100 | <asmVersion>9.1</asmVersion> | |
101 | <project.build.outputTimestamp>2022-01-08T11:19:58Z</project.build.outputTimestamp> | |
100 | <asmVersion>9.2</asmVersion> | |
101 | <project.build.outputTimestamp>2022-01-10T23:05:06Z</project.build.outputTimestamp> | |
102 | 102 | </properties> |
103 | 103 | |
104 | 104 | <dependencyManagement> |
184 | 184 | <dependency> |
185 | 185 | <groupId>org.codehaus.plexus</groupId> |
186 | 186 | <artifactId>plexus-component-annotations</artifactId> |
187 | <version>2.1.0</version> | |
188 | <exclusions> | |
189 | <exclusion> | |
190 | <groupId>junit</groupId> | |
191 | <artifactId>junit</artifactId> | |
192 | </exclusion> | |
193 | </exclusions> | |
187 | <version>2.1.1</version> | |
194 | 188 | </dependency> |
195 | 189 | <dependency> |
196 | 190 | <groupId>org.codehaus.plexus</groupId> |
285 | 279 | <plugin> |
286 | 280 | <groupId>org.codehaus.plexus</groupId> |
287 | 281 | <artifactId>plexus-component-metadata</artifactId> |
288 | <version>2.1.0</version> | |
282 | <version>2.1.1</version> | |
289 | 283 | <executions> |
290 | 284 | <execution> |
291 | 285 | <goals> |