Maven gpg plugin cant find artifact

323 Views Asked by At

ive been trying to push my project into the maven repository and im trying to configure my maven gpg plugin correctly, im currently using it as

                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>

but it doesnt seem to be able to find my artifact since it gives the rr

Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign (default-cli) on project fitnesse-bootstrap-plus-theme: The project artifact has not been assembled yet. Please do not invoke this goal before the lifecycle phase "package".

my jar gets generated in the root/target folder.

1

There are 1 best solutions below

0
On

You should bind maven-gpg-plugin to phase verify which is executed after package phase and before install and deploy when you need signature to be installed / deployed.

So your configuration looks like:

                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>

You can also ommit <phase>verify</phase> because maven-gpg-plugin is default bind to correct phase.