Salman9
Salman9

Reputation: 265

Intellij - deploy on wildfly throws exception java.nio.file.NoSuchFileException

I am new to maven and wildfly so I'm not sure if I have everything setup correctly. I am using intellij 14 community edition.

I have a maven project with pom file like bellow:

<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>root</groupId>
   <version>1.0</version>
   <artifactId>project</artifactId>
   <packaging>pom</packaging>
   <name>project</name>
   <modules>
      <module>projects</module>
      <module>primary-source</module>
      <module>servlets</module>
      <module>ejbs</module>
      <module>ear</module>
   </modules>
   <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <maven.compiler.target>1.8</maven.compiler.target>
      <maven.compiler.source>1.8</maven.compiler.source>
   </properties>
   <repositories>
      <repository>
         <id>JBoss Repository</id>
         <url>https://repository.jboss.org/nexus/content/groups/public/</url>
      </repository>
      <repository>
         <id>Junit Repository</id>
         <url>http://mvnrepository.com/artifact/junit/junit/4.11</url>
      </repository>
   </repositories>

   <build>
      <finalName>${project.artifactId}</finalName>
      <pluginManagement>
         <plugins>
            <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>versions-maven-plugin</artifactId>
               <version>2.2</version>
            </plugin>
            <plugin>
               <groupId>org.wildfly.plugins</groupId>
               <artifactId>wildfly-maven-plugin</artifactId>
               <version>1.1.0.Alpha4</version>
               <configuration>
                  <port>9991</port>
                  <skip>false</skip>
               </configuration>
               <executions>
                  <execution>
                     <goals>
                     <goal>deploy</goal>
                     </goals>
                  </execution>
               </executions>
            </plugin>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-surefire-plugin</artifactId>
               <version>2.18.1</version>
            </plugin>
         </plugins>
      </pluginManagement>
   </build>
   <dependencyManagement>
      <dependencies>
         <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-7.0</artifactId>
            <version>1.0.0.Final</version>
            <type>pom</type>
            <scope>import</scope>
         </dependency>
         <dependency>
            <groupId>root.project.projects</groupId>
            <artifactId>logging</artifactId>
            <version>1.0</version>
         </dependency>
         <dependency>
            <groupId>root.project</groupId>
            <artifactId>primary-source</artifactId>
            <version>1.0</version>
         </dependency>
         <dependency>
            <groupId>root.project.servlets</groupId>
            <artifactId>servlet</artifactId>
            <version>1.0</version>
            <type>war</type>
         </dependency>
         <dependency>
            <groupId>root.project</groupId>
            <artifactId>ejbs</artifactId>
            <version>1.0</version>
            <type>ejb</type>
         </dependency>
      </dependencies>
   </dependencyManagement>
   <dependencies>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.11</version>
      </dependency>
      <dependency>
         <groupId>javax.ws.rs</groupId>
         <artifactId>javax.ws.rs-api</artifactId>
         <version>2.0</version>
      </dependency>
      <dependency>
         <groupId>org.jboss.spec.javax.ejb</groupId>
         <artifactId>jboss-ejb-api_3.2_spec</artifactId>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>org.hibernate.javax.persistence</groupId>
         <artifactId>hibernate-jpa-2.1-api</artifactId>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.spec.javax.annotation</groupId>
         <artifactId>jboss-annotations-api_1.2_spec</artifactId>
         <scope>provided</scope>
      </dependency>
      <!-- Import the Servlet API -->
      <dependency>
         <groupId>org.jboss.spec.javax.servlet</groupId>
         <artifactId>jboss-servlet-api_3.1_spec</artifactId>
         <scope>provided</scope>
      </dependency>

   </dependencies>
</project>

I am able to build the maven application with success but the problem appears when I type in "mvn wildfly:deploy" in Intellij terminal view. Then I get the following error.

Error executing FORCE_DEPLOY
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
        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:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        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.wildfly.plugin.common.DeploymentExecutionException: Error executing FORCE_DEPLOY
        at org.wildfly.plugin.deployment.standalone.StandaloneDeployment.execute(StandaloneDeployment.java:175)
        at org.wildfly.plugin.deployment.AbstractDeployment.executeDeployment(AbstractDeployment.java:138)
        at org.wildfly.plugin.deployment.AbstractDeployment.doExecute(AbstractDeployment.java:163)
        at org.wildfly.plugin.deployment.AbstractAppDeployment.doExecute(AbstractAppDeployment.java:70)
        at org.wildfly.plugin.deployment.AbstractDeployment.execute(AbstractDeployment.java:128)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
Caused by: java.nio.file.NoSuchFileException: C:\YAS\behind-the-scene\yas-mapp\target\project.maven-project
        at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
        at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
        at java.nio.file.Files.newByteChannel(Files.java:361)
        at java.nio.file.Files.newByteChannel(Files.java:407)
        at java.nio.file.Files.readAllBytes(Files.java:3152)
        at org.wildfly.plugin.deployment.standalone.StandaloneDeployment.addContent(StandaloneDeployment.java:191)
        at org.wildfly.plugin.deployment.standalone.StandaloneDeployment.createDeployOperation(StandaloneDeployment.java:201)
        at org.wildfly.plugin.deployment.standalone.StandaloneDeployment.execute(StandaloneDeployment.java:136)
        ... 26 more

I know that the target folder is missing, but I can't figure out why. I thought after a clean and install command the target file should be created. can someone help me?

thanks!

Upvotes: 0

Views: 1592

Answers (1)

Dawid Stępień
Dawid Stępień

Reputation: 1427

Your /target directory is missing because you're running the deployer plugin in the context of parent pom with packaging tag set to pom. The plugin doesn't know what module you want to deploy. If you want all modules to be deployed as one application, probably you should create another one, where a package consist of all modules will be created and deployed.

Upvotes: 1

Related Questions