Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij Idea ignores maven assembly plugin

I have a multimodule project and one module is a web app and the second one has a custom assembly.

           <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>src</descriptorRef>
                    </descriptorRefs>
                    <formats><format>jar</format></formats>
                </configuration>
                <executions>
                    <execution>
                        <id>cfg-src</id>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>

Basically I need this archive to contain maven project with sources and maven structure, no binaries etc. When I assemble WAR with maven i.e. mvn package, everything is fine. I use "src" classifier in dependcy. My WAR contains the jar with correct assembly. But when I deploy WAR with Intellij Idea (I created tomcat run config) assembly config of the project is ignored and I an incorrect one. How do I make Idea not to ignore assembly plugin. Please let me know if I'm clear.

like image 210
user1745356 Avatar asked Oct 08 '14 16:10

user1745356


People also ask

Why Maven is not working in IntelliJ?

If the dependencies weren't imported correctly (IntelliJ IDEA highlights them), try to perform the following actions: You can check your local maven repository in the Maven | Repositories settings and try to update it. You can check the jar file of the local . m2 repository to see if it was downloaded correctly.

How do I enable Maven in IntelliJ?

Add Maven supportIn the Project tool window, right-click your project and select Add Framework Support. In the dialog that opens, select Maven from the options on the left and click OK. IntelliJ IDEA adds a default POM to the project and generates the standard Maven layout in Project tool window.


1 Answers

IntelliJ does not run mvn package when you deploy your webapp in Tomcat. It runs its custom Make and Build artifact actions.

You can change this behavior by going into Run/Debug configurations dialog and setting Run Maven Goal (package in your case) as a Before launch action instead of Make and Build artifact.

Hope this helps

like image 138
Bohuslav Burghardt Avatar answered Oct 10 '22 07:10

Bohuslav Burghardt