You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Andreas Höhmann (JIRA)" <ji...@apache.org> on 2019/01/11 12:00:00 UTC

[jira] [Comment Edited] (MINSTALL-151) Projects without primary artifacts, but with attachment artifacts fail install

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

Andreas Höhmann edited comment on MINSTALL-151 at 1/11/19 11:59 AM:
--------------------------------------------------------------------

{noformat}
<profile>
  <id>ca01</id>
  <build>
    <pluginManagement>
      <plugins>
        <!-- Override version for maven-install-plugin because there is a bug in 3.0.0-M1 preventing installing of ca01-war's -->
        <!-- See: https://issues.apache.org/jira/browse/MINSTALL-151 -->
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <!-- Override version for maven-deploy-plugin because there is a similar bug in 3.0.0-M1 like the install-plugin -->
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <excludes>
            <exlude>logback.xml</exlude>
            <exlude>**/.gitignore</exlude>
            <exlude>.gitignore</exlude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <classifier>ca01</classifier>
          <archiveClasses>true</archiveClasses>
          <attachClasses>true</attachClasses>
          <classesClassifier>ca01-classes</classesClassifier>
              <webResources>
                <resource>
                  <directory>${project.build.directory}</directory>
                  <includes>
                    <include>jetty-env.xml</include>
                  </includes>
                  <targetPath>WEB-INF</targetPath>
                </resource>
          </webResources>
          <packagingExcludes>
                WEB-INF/classes,
                WEB-INF/lib/commons-logging*.jar,
                WEB-INF/lib/log4j*.jar,
                WEB-INF/lib/jcl-over-slf4j*,
                WEB-INF/lib/jul-to-slf4j*.jar,
                WEB-INF/lib/slf4j*.jar,
                WEB-INF/lib/logback*.jar,
                WEB-INF/lib/el-impl*.jar,
                WEB-INF/jetty-web.xml,
                WEB-INF/.faces-config.xml.jsfdia,
                **/.gitignore
          </packagingExcludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-ca01-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${basedir}/src/main/ca01/java/</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-ca01-resources</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>add-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>${basedir}/src/main/ca01/resources/</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>add-ca01-test-source</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${basedir}/src/test/ca01/java/</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-ca01-test-resources</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>add-test-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>${basedir}/src/test/ca01/resources/</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>
{noformat}

With that we are able to build the same web-application in 2 different "flavors" 
- online version
- and "ca01 version" -> a kind of offline version

(?) how should I configure install/deploy to archive the same results as with the "old" maven plugins?

Here is what I run ...

{noformat}
$ mvn clean install -nsu -DskipTests -Pca01

[INFO]
[INFO] --- maven-jar-plugin:3.1.1:test-jar (default) @ cad-webservice ---
[INFO] Building jar: D:\Dev\git\coc\goos\cad-webservice\target\spicecad-tests.jar
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) @ cad-webservice ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- git-commit-id-plugin:2.2.6:revision (default) @ cad-webservice ---
[INFO]
[INFO] --- maven-war-plugin:3.2.2:war (default-war) @ cad-webservice ---
[INFO] Packaging webapp
[INFO] Assembling webapp [cad-webservice] in [D:\Dev\git\coc\goos\cad-webservice\target\spicecad]
[INFO] Processing war project
[INFO] Copying webapp webResources [D:\Dev\git\coc\goos\cad-webservice\target] to [D:\Dev\git\coc\goos\cad-webservice\target\spicecad]
[INFO] Copying webapp resources [D:\Dev\git\coc\goos\cad-webservice\src\main\webapp]
[INFO] Building jar: D:\Dev\git\coc\goos\cad-webservice\target\spicecad\WEB-INF\lib\cad-webservice-2.2019.02.0-SNAPSHOT.jar
[INFO] Webapp assembled in [2106 msecs]
[INFO] Building war: D:\Dev\git\coc\goos\cad-webservice\target\spicecad-ca01.war
[INFO]
[INFO] --- maven-source-plugin:3.0.1:jar-no-fork (attach-sources) @ cad-webservice ---
[INFO] Building jar: D:\Dev\git\coc\goos\cad-webservice\target\spicecad-sources.jar
[INFO]
[INFO] --- maven-source-plugin:3.0.1:test-jar-no-fork (attach-sources) @ cad-webservice ---
[INFO] Building jar: D:\Dev\git\coc\goos\cad-webservice\target\spicecad-test-sources.jar
[INFO]
[INFO] --- maven-javadoc-plugin:3.0.1:jar (attach-javadocs) @ cad-webservice ---
[INFO] Skipping javadoc generation
[INFO]
[INFO] --- maven-javadoc-plugin:3.0.1:test-jar (attach-javadocs) @ cad-webservice ---
[INFO] Skipping javadoc generation
[INFO]
[INFO] --- maven-install-plugin:3.0.0-M1:install (default-install) @ cad-webservice ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 43.496 s
[INFO] Finished at: 2019-01-11T09:45:25+01:00
[INFO] Final Memory: 93M/1238M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install (default-install) on project cad-webservice: 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]


$ ls -la target/
total 93960
drwxr-xr-x 1 hoehmann 1049089        0 Jan 11 09:45 classes/
drwxr-xr-x 1 hoehmann 1049089        0 Jan 11 09:44 generated-sources/
drwxr-xr-x 1 hoehmann 1049089        0 Jan 11 09:45 generated-test-sources/
-rw-r--r-- 1 hoehmann 1049089     7927 Jan 11 09:44 jetty-env.xml
drwxr-xr-x 1 hoehmann 1049089        0 Jan 11 09:45 maven-archiver/
drwxr-xr-x 1 hoehmann 1049089        0 Jan 11 09:45 spicecad/
-rw-r--r-- 1 hoehmann 1049089 94863803 Jan 11 09:45 spicecad-ca01.war
-rw-r--r-- 1 hoehmann 1049089   251161 Jan 11 09:45 spicecad-classes.jar
-rw-r--r-- 1 hoehmann 1049089   161729 Jan 11 09:45 spicecad-sources.jar
-rw-r--r-- 1 hoehmann 1049089   473024 Jan 11 09:45 spicecad-tests.jar
-rw-r--r-- 1 hoehmann 1049089   431800 Jan 11 09:45 spicecad-test-sources.jar
drwxr-xr-x 1 hoehmann 1049089        0 Jan 11 09:45 test-classes/
-rw-r--r-- 1 hoehmann 1049089     5057 Jan 11 09:44 tomcat-context.xml
{noformat}




was (Author: hoehmi):
{noformat}
<profile>
  <id>ca01</id>
  <build>
    <pluginManagement>
      <plugins>
        <!-- Override version for maven-install-plugin because there is a bug in 3.0.0-M1 preventing installing of ca01-war's -->
        <!-- See: https://issues.apache.org/jira/browse/MINSTALL-151 -->
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <!-- Override version for maven-deploy-plugin because there is a similar bug in 3.0.0-M1 like the install-plugin -->
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <excludes>
            <exlude>logback.xml</exlude>
            <exlude>**/.gitignore</exlude>
            <exlude>.gitignore</exlude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <classifier>ca01</classifier>
          <archiveClasses>true</archiveClasses>
          <attachClasses>true</attachClasses>
          <classesClassifier>ca01-classes</classesClassifier>
              <webResources>
                <resource>
                  <directory>${project.build.directory}</directory>
                  <includes>
                    <include>jetty-env.xml</include>
                  </includes>
                  <targetPath>WEB-INF</targetPath>
                </resource>
          </webResources>
          <packagingExcludes>
                WEB-INF/classes,
                WEB-INF/lib/commons-logging*.jar,
                WEB-INF/lib/log4j*.jar,
                WEB-INF/lib/jcl-over-slf4j*,
                WEB-INF/lib/jul-to-slf4j*.jar,
                WEB-INF/lib/slf4j*.jar,
                WEB-INF/lib/logback*.jar,
                WEB-INF/lib/el-impl*.jar,
                WEB-INF/jetty-web.xml,
                WEB-INF/.faces-config.xml.jsfdia,
                **/.gitignore
          </packagingExcludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-ca01-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${basedir}/src/main/ca01/java/</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-ca01-resources</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>add-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>${basedir}/src/main/ca01/resources/</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>add-ca01-test-source</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${basedir}/src/test/ca01/java/</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-ca01-test-resources</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>add-test-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>${basedir}/src/test/ca01/resources/</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>
{noformat}

With that we are able to build the same web-application in 2 different "flavors" 
- online version
- and "ca01 version" -> a kind of offline version

(?) how should I configure install/deploy to archive the same results as with the "old" maven plugins?


> 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.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
(v7.6.3#76005)