Skip to content

Commit

Permalink
Merge pull request #108 from s4u/fix-105
Browse files Browse the repository at this point in the history
Skip primary artifact without file
  • Loading branch information
slawekjaranowski authored Jan 7, 2022
2 parents ddfcf97 + d77467f commit 29fd212
Show file tree
Hide file tree
Showing 9 changed files with 297 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/it/issue-105/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Copyright 2022 Slawomir Jaranowski
#
# Licensed 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 --no-transfer-progress -Dsettings.security=${project.basedir}/src/it/settings-security.xml
invoker.mavenOpts = ${argLine}

invoker.environmentVariables.SIGN_KEY_ID = AC71B3E31C0C0D38
invoker.environmentVariables.SIGN_KEY_PASS = {p01Vm25gEoIH/wDlR3hWNhOH5mn4PBEnSFEtH96k1Yw=}

invoker.ordinal = 100
40 changes: 40 additions & 0 deletions src/it/issue-105/issue-105-api/pom-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2022 Slawomir Jaranowski
~
~ Licensed 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-group</groupId>
<artifactId>issue-105-parent</artifactId>
<version>1.0.0</version>
<relativePath>../pom-test.xml</relativePath>
</parent>

<artifactId>issue-105-api</artifactId>
<packaging>bundle</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
</plugin>
</plugins>
</build>

</project>
22 changes: 22 additions & 0 deletions src/it/issue-105/issue-105-api/src/main/java/test/TestService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2022 Slawomir Jaranowski
*
* Licensed 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.
*/
package test;

/**
* Test service.
*/
public interface TestService {
}
43 changes: 43 additions & 0 deletions src/it/issue-105/issue-105-features/pom-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2022 Slawomir Jaranowski
~
~ Licensed 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-group</groupId>
<artifactId>issue-105-parent</artifactId>
<version>1.0.0</version>
<relativePath>../pom-test.xml</relativePath>
</parent>

<artifactId>issue-105-features</artifactId>
<packaging>feature</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<enableGeneration>true</enableGeneration>
<aggregateFeatures>true</aggregateFeatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2022 Slawomir Jaranowski
~
~ Licensed 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.
-->
<features name="asciidoc-converter-required-capabilities-${project.version}"
xmlns="http://karaf.apache.org/xmlns/features/v1.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.5.0 http://karaf.apache.org/xmlns/features/v1.5.0">

<!-- These services provided by platform -->
<feature name="test-required-capabilities">
<capability>osgi.extender;osgi.extender=osgi.component;version=1.3.0</capability>
</feature>

</features>
27 changes: 27 additions & 0 deletions src/it/issue-105/issue-105-features/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2022 Slawomir Jaranowski
~
~ Licensed 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.
-->
<features name="asciidoc-converter-${project.version}"
xmlns="http://karaf.apache.org/xmlns/features/v1.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.5.0 http://karaf.apache.org/xmlns/features/v1.5.0">

<feature name="test-feature" version="${project.version}" description="Test services">
<feature prerequisite="true">scr</feature>
<bundle>mvn:org.slf4j/slf4j-api/1.7.32</bundle>
</feature>

</features>
85 changes: 85 additions & 0 deletions src/it/issue-105/pom-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!--
~ Copyright 2022 Slawomir Jaranowski
~
~ Licensed 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test-group</groupId>
<artifactId>issue-105-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<modules>
<module>issue-105-api/pom-test.xml</module>
<module>issue-105-features/pom-test.xml</module>
</modules>

<build>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>@maven-bundle-plugin.version@</version>
</plugin>

<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>4.3.3</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version><!-- MINSTALL-151 -->
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>@maven-deploy-plugin.version@</version>
</plugin>

</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.simplify4u.plugins</groupId>
<artifactId>sign-maven-plugin</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<keyFile>@project.basedir@/src/test/resources/priv-key.asc</keyFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
19 changes: 19 additions & 0 deletions src/it/verify-sign/pom-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,25 @@
<classifier>c1</classifier>
</dependency>

<dependency>
<groupId>test-group</groupId>
<artifactId>issue-105-parent</artifactId>
<type>pom</type>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>test-group</groupId>
<artifactId>issue-105-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>test-group</groupId>
<artifactId>issue-105-features</artifactId>
<version>1.0.0</version>
<classifier>features</classifier>
<type>xml</type>
</dependency>

</dependencies>

<build>
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/org/simplify4u/plugins/sign/SignMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,18 @@ public void execute() {
// collect artifact to sign
Set<Artifact> artifactsToSign = new HashSet<>();

artifactsToSign.add(new ProjectArtifact(project));
artifactsToSign.add(project.getArtifact());
ProjectArtifact projectArtifact = new ProjectArtifact(project);
artifactsToSign.add(projectArtifact);

Artifact artifact = project.getArtifact();
if (artifact.getFile() != null) {
artifactsToSign.add(artifact);
} else {
if (!artifact.equals(projectArtifact)) {
LOGGER.info("Primary artifact doesn't have the file to sign, continue with attached artifacts.");
}
}

artifactsToSign.addAll(project.getAttachedArtifacts());

// sign and attach signature to project
Expand Down

0 comments on commit 29fd212

Please sign in to comment.