Sonar-maven-plugin with maven-assembly-plugin and spring-boot-maven-plugin

Hi Bro,
I have problem when install my project with dependency sonar-maven-plugin as follows :

<build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>busico</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>busico</id>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <phase>package</phase>
                                <configuration>
                                    <descriptors>
                                        <descriptor>assembly/assembly-linux.xml</descriptor>
                                    </descriptors>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
                <finalName>busico-gateway</finalName>
            </build>
        </profile>
        <profile>
            <id>windows</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>windows</id>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <phase>package</phase>
                                <configuration>
                                    <descriptors>
                                        <descriptor>assembly/assembly-windows.xml</descriptor>
                                    </descriptors>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
                <finalName>busico-gateway</finalName>
            </build>
        </profile>
    </profiles>

When I run the command mvn -Pwindows clean install , the jar package inside the final generated zip package is not executable。But the busico-gateway.jar in the target folder is executable。

jar in the targe folder looks like blow:

If I delete the sonar-maven-plugin dependency , the jar in the final zip package is executable.
Cause I want to set windows or Linux services to run the jar file , and Sonarqube to test the code, I don’t want to delete the dependency.
I can’t fix it for a long time! Can anyone help? Thanks very much

Hi,

You don’t need to list it as a plugin in your pom in order to be able to analyze. In fact, in most cases, it’s best not to include it in your pom. That’s really only for when you want to pin to a specific version of the plugin (which you mostly don’t want to do).

Can you comment that out and just trying analyzing with mvn sonar:sonar -Dsonar.login=myAuthenticationToken (assuming you’ve set sonar.host.url in your settings).

 
Ann

You said it! Thank you very much !