2

When I try to deploy a JHipster application via Maven deploy plugin to Nexus I get the following error.

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project profiletoolservice: Failed to deploy artifacts: Could not transfer artifact io.crowdcode.prf:profiletoolservice:war:1.0.0-20180209.081617-4 from/to repo.crowdcode.io (......repository/snapshots/): Failed to transfer file: ....../repository/snapshots/io/crowdcode/prf/profiletoolservice/1.0.0-SNAPSHOT/profiletoolservice-1.0.0-20180209.081617-4.war. Return code is: 400, ReasonPhrase: Detected content type [application/x-sh], but expected [application/java-archive, application/x-tika-java-web-archive]: ......../profiletoolservice/1.0.0-SNAPSHOT/profiletoolservice-1.0.0-20180209.081617-4.war.

When deploing to my Nexus running on local host everything works as expected.

The problem arises when I deploy to our proxy repository.

A hexdump from profiletoolservice-1.0.0-20180209.081617-4.war shows

00000000  23 21 2f 62 69 6e 2f 62  61 73 68 0a 23 0a 23 20  |#!/bin/bash.#.# |

00000010  20 20 20 2e 20 20 20 5f  5f 5f 5f 20 20 20 20 20  |   .   ____     |
Rok Prodan
  • 749
  • 8
  • 22

2 Answers2

2

This is normal, JHipster packages your app as a Spring Boot executable war which consists in putting a shell script at top of the archive, so Nexus thinks you upload a shell script rather than a war file. Update your repository settings in Nexus admin interface to allow it.

Gaël Marziou
  • 16,028
  • 4
  • 38
  • 49
0

Spring Boot Executables are enabled by the tag inside the of the maven plugin configuration. This makes the spring boot plugin embedding the jar file into a wrapper shell script which makes a deployment to nexus impossible. Since this is a mime type violation only heaven knows, why they keep calling the artifact app.war instead of app.sh or whatever.

            <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>${spring-boot.version}</version>
            <executions>
            .......
            </executions>
            <configuration>
                .......
                <executable>true</executable>
                .......
            </configuration>
        </plugin>

To get rid of your problem, simply remove the executable tag.

gorefest
  • 849
  • 8
  • 22
  • They keep calling it app.war because it can still be deployed in a servlet container like Tomcat. – Gaël Marziou Feb 09 '18 at 13:40
  • Gaël Marziou i really doubt that deploying a shell script is possible in tomcat. Although I would not be surprised ;-) – gorefest Feb 09 '18 at 14:55
  • They do not recommend it https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html#deployment-install eventually it all depends on how you plan to run your app, when run as a linux service it makes sense using the executable trick – Gaël Marziou Feb 09 '18 at 18:17