This is an automated email from the ASF dual-hosted git repository. rfscholte pushed a commit to branch maven-sign-plugin in repository https://gitbox.apache.org/repos/asf/maven-studies.git
commit 53a805901ef8c0871167433c14fd9cf36b5f67dd Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Sat Sep 26 12:27:59 2020 +0200 plugin skeleton --- .gitignore | 3 + lombok.config | 18 ++++ pom.xml | 120 +++++++++++++++++++++ src/it/settings.xml | 55 ++++++++++ src/it/standard-packaging/invoker.properties | 21 ++++ src/it/standard-packaging/pom.xml | 47 ++++++++ .../org/apache/maven/plugins/sign/SignMojo.java | 46 ++++++++ 7 files changed, 310 insertions(+) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e02456b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +target/ +.idea +*.iml diff --git a/lombok.config b/lombok.config new file mode 100644 index 0000000..767ef75 --- /dev/null +++ b/lombok.config @@ -0,0 +1,18 @@ +# 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. + +lombok.log.fieldName=LOGGER diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..84d8b26 --- /dev/null +++ b/pom.xml @@ -0,0 +1,120 @@ +<?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 + ~ 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. + ~ + --> + +<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>maven-plugins</artifactId> + <groupId>org.apache.maven.plugins</groupId> + <version>34</version> + <relativePath/> + </parent> + + <artifactId>maven-sign-plugin</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>maven-plugin</packaging> + + <name>Apache Maven Sign Plugin</name> + + <prerequisites> + <maven>${mavenVersion}</maven> + </prerequisites> + + <scm> + <connection>scm:git:https://gitbox.apache.org/repos/asf/maven-studies.git</connection> + <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-studies.git</developerConnection> + <url>https://github.com/apache/maven-studies/tree/${project.scm.tag}</url> + <tag>maven-sign-plugin</tag> + </scm> + + <distributionManagement> + <site> + <id>apache.website</id> + <url>scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path}</url> + </site> + </distributionManagement> + + <properties> + <mavenVersion>3.0</mavenVersion> + <javaVersion>8</javaVersion> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>${mavenVersion}</version> + </dependency> + + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <version>${mavenVersion}</version> + </dependency> + + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.18.12</version> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.7.30</version> + </dependency> + + </dependencies> + + <profiles> + + <profile> + <id>run-its</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-invoker-plugin</artifactId> + <configuration> + <goals> + <goal>install</goal> + </goals> + <debug>false</debug> + <showErrors>true</showErrors> + <showVersion>true</showVersion> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + </profiles> +</project> diff --git a/src/it/settings.xml b/src/it/settings.xml new file mode 100644 index 0000000..28f9d85 --- /dev/null +++ b/src/it/settings.xml @@ -0,0 +1,55 @@ +<?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 + ~ 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. + ~ + --> +<settings> + <profiles> + <profile> + <id>it-repo</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <repositories> + <repository> + <id>local.central</id> + <url>@localRepositoryUrl@</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>local.central</id> + <url>@localRepositoryUrl@</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + </profiles> +</settings> diff --git a/src/it/standard-packaging/invoker.properties b/src/it/standard-packaging/invoker.properties new file mode 100644 index 0000000..07fd24e --- /dev/null +++ b/src/it/standard-packaging/invoker.properties @@ -0,0 +1,21 @@ +# +# 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. +# + +invoker.goals = install -Drevision=1.1.1-SNAPSHOT + diff --git a/src/it/standard-packaging/pom.xml b/src/it/standard-packaging/pom.xml new file mode 100644 index 0000000..627c7b9 --- /dev/null +++ b/src/it/standard-packaging/pom.xml @@ -0,0 +1,47 @@ +<?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 + ~ 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. + ~ + --> + +<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>test-group</groupId> + <artifactId>test1</artifactId> + <version>${revision}</version> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-sign-plugin</artifactId> + <version>@project.version@</version> + <executions> + <execution> + <goals> + <goal>sign</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/src/main/java/org/apache/maven/plugins/sign/SignMojo.java b/src/main/java/org/apache/maven/plugins/sign/SignMojo.java new file mode 100644 index 0000000..f356273 --- /dev/null +++ b/src/main/java/org/apache/maven/plugins/sign/SignMojo.java @@ -0,0 +1,46 @@ +package org.apache.maven.plugins.sign; + +/* + * 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 lombok.extern.slf4j.Slf4j; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; + +/** + * Sign project artifacts. + */ +@Slf4j +@Mojo( name = "sign", defaultPhase = LifecyclePhase.VERIFY ) +public class SignMojo extends AbstractMojo +{ + + @Parameter( defaultValue = "${project}", readonly = true, required = true ) + private MavenProject project; + + @Override + public void execute() + { + LOGGER.info( "Artifact : {}", project.getArtifact() ); + LOGGER.info( "Artifacts: {}", project.getArtifacts() ); + } +}