maven assembly plugin is not working with pluginManagement












1















Below is my configuration of maven-assembly-plugin and it's working fine.but when i am adding my all plugins inside the pluginManagement parent tag it's not working.



I am not sure why it's not working



<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>MyId</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptor>assemblyFile.xml</descriptor>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>









share|improve this question


















  • 1





    First you are using an very old version of maven-assembly-plugin furthermore the pluginManagement is intended to define versions and configurations of plugins but not to really execute plugins (meaning binding to the life cycle)...

    – khmarbaise
    Jan 4 '18 at 8:15











  • @khmarbaise thanks, yes added dependency to bind to the life cycle . That was miss from my side :)

    – Niraj Sonawane
    Jan 4 '18 at 9:13
















1















Below is my configuration of maven-assembly-plugin and it's working fine.but when i am adding my all plugins inside the pluginManagement parent tag it's not working.



I am not sure why it's not working



<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>MyId</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptor>assemblyFile.xml</descriptor>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>









share|improve this question


















  • 1





    First you are using an very old version of maven-assembly-plugin furthermore the pluginManagement is intended to define versions and configurations of plugins but not to really execute plugins (meaning binding to the life cycle)...

    – khmarbaise
    Jan 4 '18 at 8:15











  • @khmarbaise thanks, yes added dependency to bind to the life cycle . That was miss from my side :)

    – Niraj Sonawane
    Jan 4 '18 at 9:13














1












1








1








Below is my configuration of maven-assembly-plugin and it's working fine.but when i am adding my all plugins inside the pluginManagement parent tag it's not working.



I am not sure why it's not working



<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>MyId</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptor>assemblyFile.xml</descriptor>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>









share|improve this question














Below is my configuration of maven-assembly-plugin and it's working fine.but when i am adding my all plugins inside the pluginManagement parent tag it's not working.



I am not sure why it's not working



<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>MyId</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptor>assemblyFile.xml</descriptor>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>






maven maven-assembly-plugin






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 4 '18 at 5:46









Niraj SonawaneNiraj Sonawane

2,35421940




2,35421940








  • 1





    First you are using an very old version of maven-assembly-plugin furthermore the pluginManagement is intended to define versions and configurations of plugins but not to really execute plugins (meaning binding to the life cycle)...

    – khmarbaise
    Jan 4 '18 at 8:15











  • @khmarbaise thanks, yes added dependency to bind to the life cycle . That was miss from my side :)

    – Niraj Sonawane
    Jan 4 '18 at 9:13














  • 1





    First you are using an very old version of maven-assembly-plugin furthermore the pluginManagement is intended to define versions and configurations of plugins but not to really execute plugins (meaning binding to the life cycle)...

    – khmarbaise
    Jan 4 '18 at 8:15











  • @khmarbaise thanks, yes added dependency to bind to the life cycle . That was miss from my side :)

    – Niraj Sonawane
    Jan 4 '18 at 9:13








1




1





First you are using an very old version of maven-assembly-plugin furthermore the pluginManagement is intended to define versions and configurations of plugins but not to really execute plugins (meaning binding to the life cycle)...

– khmarbaise
Jan 4 '18 at 8:15





First you are using an very old version of maven-assembly-plugin furthermore the pluginManagement is intended to define versions and configurations of plugins but not to really execute plugins (meaning binding to the life cycle)...

– khmarbaise
Jan 4 '18 at 8:15













@khmarbaise thanks, yes added dependency to bind to the life cycle . That was miss from my side :)

– Niraj Sonawane
Jan 4 '18 at 9:13





@khmarbaise thanks, yes added dependency to bind to the life cycle . That was miss from my side :)

– Niraj Sonawane
Jan 4 '18 at 9:13












1 Answer
1






active

oldest

votes


















0














The execution section of your maven-assembly-plugin should not be contained in a pluginManagement section. If it is, it will be ignored. The build will not throw an error - just won't create an executable jar. Then you would get "no main manifest attribute..." if you try to run it.



The pluginManagement section, generally defined in a "parent" pom, shares plugin configuration across modules. It can specify version and configuration and it ensures the version matches across child poms, but is not intended to contain execution details.



Here's a valid example where pluginManagement specifies only the plugin's version (just keep in mind the pluginManagement would typically be in a separate, parent, pom):



<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.my.App</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


And here's an example where pluginManagement has the plugin's version and also its configuration. The regular plugin section specifies only the execution details:



<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.my.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


Note that child poms can override pluginManagement definitions.



See also this question and its answers.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48089364%2fmaven-assembly-plugin-is-not-working-with-pluginmanagement%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The execution section of your maven-assembly-plugin should not be contained in a pluginManagement section. If it is, it will be ignored. The build will not throw an error - just won't create an executable jar. Then you would get "no main manifest attribute..." if you try to run it.



    The pluginManagement section, generally defined in a "parent" pom, shares plugin configuration across modules. It can specify version and configuration and it ensures the version matches across child poms, but is not intended to contain execution details.



    Here's a valid example where pluginManagement specifies only the plugin's version (just keep in mind the pluginManagement would typically be in a separate, parent, pom):



    <build>
    <pluginManagement>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.4.1</version>
    </plugin>
    </plugins>
    </pluginManagement>
    <plugins>
    <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
    <descriptorRefs>
    <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
    <archive>
    <manifest>
    <mainClass>com.my.App</mainClass>
    </manifest>
    </archive>
    </configuration>
    <executions>
    <execution>
    <id>make-assembly</id>
    <phase>package</phase>
    <goals>
    <goal>single</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>


    And here's an example where pluginManagement has the plugin's version and also its configuration. The regular plugin section specifies only the execution details:



    <build>
    <pluginManagement>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.4.1</version>
    <configuration>
    <descriptorRefs>
    <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
    <archive>
    <manifest>
    <mainClass>com.my.App</mainClass>
    </manifest>
    </archive>
    </configuration>
    </plugin>
    </plugins>
    </pluginManagement>
    <plugins>
    <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.3</version>
    <executions>
    <execution>
    <id>make-assembly</id>
    <phase>package</phase>
    <goals>
    <goal>single</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>


    Note that child poms can override pluginManagement definitions.



    See also this question and its answers.






    share|improve this answer






























      0














      The execution section of your maven-assembly-plugin should not be contained in a pluginManagement section. If it is, it will be ignored. The build will not throw an error - just won't create an executable jar. Then you would get "no main manifest attribute..." if you try to run it.



      The pluginManagement section, generally defined in a "parent" pom, shares plugin configuration across modules. It can specify version and configuration and it ensures the version matches across child poms, but is not intended to contain execution details.



      Here's a valid example where pluginManagement specifies only the plugin's version (just keep in mind the pluginManagement would typically be in a separate, parent, pom):



      <build>
      <pluginManagement>
      <plugins>
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.4.1</version>
      </plugin>
      </plugins>
      </pluginManagement>
      <plugins>
      <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
      <descriptorRefs>
      <descriptorRef>jar-with-dependencies</descriptorRef>
      </descriptorRefs>
      <archive>
      <manifest>
      <mainClass>com.my.App</mainClass>
      </manifest>
      </archive>
      </configuration>
      <executions>
      <execution>
      <id>make-assembly</id>
      <phase>package</phase>
      <goals>
      <goal>single</goal>
      </goals>
      </execution>
      </executions>
      </plugin>
      </plugins>
      </build>


      And here's an example where pluginManagement has the plugin's version and also its configuration. The regular plugin section specifies only the execution details:



      <build>
      <pluginManagement>
      <plugins>
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.4.1</version>
      <configuration>
      <descriptorRefs>
      <descriptorRef>jar-with-dependencies</descriptorRef>
      </descriptorRefs>
      <archive>
      <manifest>
      <mainClass>com.my.App</mainClass>
      </manifest>
      </archive>
      </configuration>
      </plugin>
      </plugins>
      </pluginManagement>
      <plugins>
      <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.3</version>
      <executions>
      <execution>
      <id>make-assembly</id>
      <phase>package</phase>
      <goals>
      <goal>single</goal>
      </goals>
      </execution>
      </executions>
      </plugin>
      </plugins>
      </build>


      Note that child poms can override pluginManagement definitions.



      See also this question and its answers.






      share|improve this answer




























        0












        0








        0







        The execution section of your maven-assembly-plugin should not be contained in a pluginManagement section. If it is, it will be ignored. The build will not throw an error - just won't create an executable jar. Then you would get "no main manifest attribute..." if you try to run it.



        The pluginManagement section, generally defined in a "parent" pom, shares plugin configuration across modules. It can specify version and configuration and it ensures the version matches across child poms, but is not intended to contain execution details.



        Here's a valid example where pluginManagement specifies only the plugin's version (just keep in mind the pluginManagement would typically be in a separate, parent, pom):



        <build>
        <pluginManagement>
        <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4.1</version>
        </plugin>
        </plugins>
        </pluginManagement>
        <plugins>
        <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
        <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <archive>
        <manifest>
        <mainClass>com.my.App</mainClass>
        </manifest>
        </archive>
        </configuration>
        <executions>
        <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
        <goal>single</goal>
        </goals>
        </execution>
        </executions>
        </plugin>
        </plugins>
        </build>


        And here's an example where pluginManagement has the plugin's version and also its configuration. The regular plugin section specifies only the execution details:



        <build>
        <pluginManagement>
        <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4.1</version>
        <configuration>
        <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <archive>
        <manifest>
        <mainClass>com.my.App</mainClass>
        </manifest>
        </archive>
        </configuration>
        </plugin>
        </plugins>
        </pluginManagement>
        <plugins>
        <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.3</version>
        <executions>
        <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
        <goal>single</goal>
        </goals>
        </execution>
        </executions>
        </plugin>
        </plugins>
        </build>


        Note that child poms can override pluginManagement definitions.



        See also this question and its answers.






        share|improve this answer















        The execution section of your maven-assembly-plugin should not be contained in a pluginManagement section. If it is, it will be ignored. The build will not throw an error - just won't create an executable jar. Then you would get "no main manifest attribute..." if you try to run it.



        The pluginManagement section, generally defined in a "parent" pom, shares plugin configuration across modules. It can specify version and configuration and it ensures the version matches across child poms, but is not intended to contain execution details.



        Here's a valid example where pluginManagement specifies only the plugin's version (just keep in mind the pluginManagement would typically be in a separate, parent, pom):



        <build>
        <pluginManagement>
        <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4.1</version>
        </plugin>
        </plugins>
        </pluginManagement>
        <plugins>
        <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
        <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <archive>
        <manifest>
        <mainClass>com.my.App</mainClass>
        </manifest>
        </archive>
        </configuration>
        <executions>
        <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
        <goal>single</goal>
        </goals>
        </execution>
        </executions>
        </plugin>
        </plugins>
        </build>


        And here's an example where pluginManagement has the plugin's version and also its configuration. The regular plugin section specifies only the execution details:



        <build>
        <pluginManagement>
        <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4.1</version>
        <configuration>
        <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <archive>
        <manifest>
        <mainClass>com.my.App</mainClass>
        </manifest>
        </archive>
        </configuration>
        </plugin>
        </plugins>
        </pluginManagement>
        <plugins>
        <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.3</version>
        <executions>
        <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
        <goal>single</goal>
        </goals>
        </execution>
        </executions>
        </plugin>
        </plugins>
        </build>


        Note that child poms can override pluginManagement definitions.



        See also this question and its answers.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 19 at 16:37

























        answered Nov 17 '18 at 23:49









        J WoodchuckJ Woodchuck

        8951023




        8951023






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48089364%2fmaven-assembly-plugin-is-not-working-with-pluginmanagement%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Academy of Television Arts & Sciences

            L'Équipe

            1995 France bombings