[ 
https://issues.apache.org/jira/browse/MINSTALL-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627326#comment-17627326
 ] 

Peter De Maeyer edited comment on MINSTALL-151 at 11/1/22 8:53 PM:
-------------------------------------------------------------------

My use case: some of my submodules in my multi-module project only produce 
artifacts of type "test-jar". In other words, they don't have produce a main 
{{my-artifact-1.0.0.jar}}, but they _do_ produce a 
{{my-artifact-1.0.0-tests.jar}}. In my parent POM I have a section which fits 
for any module that produces either or both a main or test artifact, as 
supported by the default {{maven-jar-plugin}}:

{code:xml}
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <!-- The ID must match the ID of the default goal, 
because we want to reconfigure it. -->
                        <id>default-jar</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <!-- Don't produce an artifact of type "jar" if 
main/src is empty. -->
                        <configuration>
                            <skipIfEmpty>true</skipIfEmpty>
                        </configuration>
                    </execution>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <!-- Don't produce an artifact of type "test-jar" if 
test/src is empty. -->
                        <configuration>
                            <skipIfEmpty>true</skipIfEmpty>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
{code}

{{maven-install-plugin}} fails with the above "The packaging plugin for this 
project did not assign a main file to the project but it has attachments. 
Change packaging to 'pom'."

The advice is wrong, I can't change packaging to 'pom' because then it won't 
compile nor run my tests.


was (Author: peterdm):
My use case: some of my submodules in my multi-module project only produce 
artifacts of type "test-jar". In other words, they don't have produce a main 
{{my-artifact-1.0.0.jar}}, but they _do_ produce a 
{{my-artifact-1.0.0-tests.jar}}. In my parent POM I have a section which fits 
for any module that produces either or both a main or test artifact, as 
supported by the default {{maven-jar-plugin}}:

{code:xml}
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <!-- The ID must match the ID of the default goal, 
because we want to reconfigure it. -->
                        <id>default-jar</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <!-- Don't produce an artifact of type "jar" if 
main/src is empty. -->
                        <configuration>
                            <skipIfEmpty>true</skipIfEmpty>
                        </configuration>
                    </execution>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <!-- Don't produce an artifact of type "test-jar" if 
test/src is empty. -->
                        <configuration>
                            <skipIfEmpty>true</skipIfEmpty>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
{code}

> Projects without primary artifacts, but with attachment artifacts fail install
> ------------------------------------------------------------------------------
>
>                 Key: MINSTALL-151
>                 URL: https://issues.apache.org/jira/browse/MINSTALL-151
>             Project: Maven Install Plugin
>          Issue Type: Bug
>    Affects Versions: 3.0.0-M1
>            Reporter: Peter Huffer
>            Priority: Major
>         Attachments: minstall-151-example-PeterSchloemer.zip, minstall-151.zip
>
>
> I have a module which has a packaging of {{feature}} from the 
> {{karaf-maven-plugin}}. When running the {{mvn install}} command, the 
> following error occurs:
> {code:java}
> Failed to execute goal 
> org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install 
> (default-install) on project <project_name>: NoFileAssignedException: The 
> packaging plugin for this project did not assign a main file to the project 
> but it has attachments. Change packaging to 'pom'. -> [Help 1]
> {code}
> Reverting back to version {{2.5.2}} made the {{mvn install}} command succeed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to