Ceci est mon premier projet utilisant Spring (et je n’ai pas trop d’expérience avec Maven) et j’obtiens l’erreur dans le titre lorsque je lance mvn package
.
C'est mon pom.xml:
<project xmlns="http://maven.Apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.Apache.org/POM/4.0.0 http://maven.Apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hu.infolaverage.europress.imageprovider</groupId>
<artifactId>imageprovider</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.2.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>hu.infolaverage.europress.imageprovider.App</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.Apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.7.11</version>
</dependency>
<dependency>
<groupId>org.Apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.7.11</version>
</dependency>
<dependency>
<groupId>org.Apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>2.7.11</version>
</dependency>
<dependency>
<groupId>org.Apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>2.7.11</version>
</dependency>
<dependency>
<groupId>org.Apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.0.2.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Et voici l'erreur complète:
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.Apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building imageprovider 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ imageprovider ---
[INFO]
[INFO] --- spring-boot-maven-plugin:1.0.2.RELEASE:repackage (default) @ imageprovider ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.451 s
[INFO] Finished at: 2014-05-06T09:06:49+01:00
[INFO] Final Memory: 13M/167M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.0.2.RELEASE:repackage (default) on project imageprovider: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.0.2.RELEASE:repackage failed: Source must refer to an existing file -> [Help 1]
org.Apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.0.2.RELEASE:repackage (default) on project imageprovider: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.0.2.RELEASE:repackage failed: Source must refer to an existing file
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.Java:224)
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.Java:153)
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.Java:145)
at org.Apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.Java:108)
at org.Apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.Java:76)
at org.Apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.Java:51)
at org.Apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.Java:116)
at org.Apache.maven.DefaultMaven.doExecute(DefaultMaven.Java:361)
at org.Apache.maven.DefaultMaven.execute(DefaultMaven.Java:155)
at org.Apache.maven.cli.MavenCli.execute(MavenCli.Java:584)
at org.Apache.maven.cli.MavenCli.doMain(MavenCli.Java:213)
at org.Apache.maven.cli.MavenCli.main(MavenCli.Java:157)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.Java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.Java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.Java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.Java:356)
Caused by: org.Apache.maven.plugin.PluginExecutionException: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.0.2.RELEASE:repackage failed: Source must refer to an existing file
at org.Apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.Java:144)
at org.Apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.Java:208)
... 19 more
Caused by: Java.lang.IllegalArgumentException: Source must refer to an existing file
at org.springframework.boot.loader.tools.Repackager.<init>(Repackager.Java:56)
at org.springframework.boot.maven.RepackageMojo$1.<init>(RepackageMojo.Java:102)
at org.springframework.boot.maven.RepackageMojo.execute(RepackageMojo.Java:102)
at org.Apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.Java:133)
... 20 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.Apache.org/confluence/display/MAVEN/PluginExecutionException
La même chose se produit lorsque je supprime les version
et executions
du spring-boot-maven-plugin
.
Ok, j'ai trouvé l'erreur. Je devais changer le paramètre packaging
en jar
de pom
. De plus, les variables repositories
, pluginRepositories
, maven-compiler-plugin
et spring-boot-maven-plugin
's version
et executions
n'étaient pas nécessaires.
Essayez mvn install
avant d'exécuter spring-boot:repackage
:
mvn clean install spring-boot:repackage
Juste en ajoutant mon expérience:
Après aucune des solutions suggérées a fonctionné. J'ai découvert qu'il y avait un problème avec le plugin téléchargé Spring-Boot-Maven-plugin dans le dossier. Supprimer le plug-in et autoriser le téléchargement et la construction de "l'installation en clair" a fonctionné.