AdamBien / wad

Watch and Deploy - deploying ThinWARs without IDE plugins
http://wad.sh
MIT License
111 stars 24 forks source link

WAD on Windows Errors #5

Closed pedanticdev closed 5 years ago

pedanticdev commented 5 years ago

Trying to use WAD on Windows and I keep getting

?[34m 'C:\Users\john\servers\payara5\glassfish\domains\domain1\autodeploy' ?[0m
WAD is watching .\src\main, deploying target\cdi-code.war to [C:\Users\john\servers\payara5\glassfish\domains\domain1\autodeploy\cd
i-code.war]
[?[1;90m09:48:37?[0m]Exception in thread "main" java.lang.IllegalStateException: Maven application directory was not specified, and $
{maven.home} is not provided in the system properties. Please specify at least on of these.
        at org.apache.maven.shared.invoker.MavenCommandLineBuilder.checkRequiredState(MavenCommandLineBuilder.java:126)
        at org.apache.maven.shared.invoker.MavenCommandLineBuilder.build(MavenCommandLineBuilder.java:61)
        at org.apache.maven.shared.invoker.DefaultInvoker.execute(DefaultInvoker.java:100)
        at com.airhacks.wad.watch.control.Builder.build(Builder.java:40)
        at com.airhacks.wad.watch.boundary.WADFlow.buildAndDeploy(WADFlow.java:65)
        at com.airhacks.wad.watch.boundary.WADFlow.lambda$new$0(WADFlow.java:41)
        at com.airhacks.wad.watch.boundary.WADFlow.<init>(WADFlow.java:42)
        at wad.App.main(App.java:75)

when I run the java -jar wad.jar [deployment-dir] command. I'm not sure what I need to do. mvn -v gives me

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
Maven home: C:\Users\john\mvn\apache-maven-3.5.3\bin\..
Java version: 1.8.0_162, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_162\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
AdamBien commented 5 years ago

Have you specified MAVEN_HOME env variable? wad.sh uses https://maven.apache.org/shared/maven-invoker/ behind the scenes. The doc might be useful. In parallel I asked on twitter for windows help :-)

mschnitzler commented 5 years ago

I'm running wad on Windows. Had to add a system property when starting wad like this: java -Dmaven.home="C:\Tools\maven\apache-maven-3.5.2" -jar wad.jar C:\server\wildfly-16.0.0.Final\standalone\deployments

rieckpil commented 5 years ago

I got it running with M2_HOME env variable pointing to the Maven installation folder

mschnitzler commented 5 years ago

I got it running with M2_HOME env variable pointing to the Maven installation folder

This does the trick on my machine as well. Thanks.

pedanticdev commented 5 years ago

Have you specified MAVEN_HOME env variable? wad.sh uses https://maven.apache.org/shared/maven-invoker/ behind the scenes. The doc might be useful. In parallel I asked on twitter for windows help :-)

Yes MAVEN_HOME set. Docs seems geared towards one using a Unix based OS.

I got it running with M2_HOME env variable pointing to the Maven installation folder

This got it up but then I get this [08:01:22]org.apache.maven.shared.invoker.MavenInvocationException Error configuring command-line. Reason: Maven executable not found at: C:\Users\john\mvn\apache-maven-3.5.3\bin\bin\mvn.bat

Downloaded a fresh version of Maven into the folder but still.

mschnitzler commented 5 years ago

This got it up but then I get this [�[1;90m08:01:22�[0m]org.apache.maven.shared.invoker.MavenInvocationException Error configuring command-line. Reason: Maven executable not found at: C:\Users\john\mvn\apache-maven-3.5.3\bin\bin\mvn.bat

Seems like you set M2_HOME to C:\Users\john\mvn\apache-maven-3.5.3\bin. Try setting it to C:\Users\john\mvn\apache-maven-3.5.3 without the extra "\bin".

pedanticdev commented 5 years ago

This got it up but then I get this [�[1;90m08:01:22�[0m]org.apache.maven.shared.invoker.MavenInvocationException Error configuring command-line. Reason: Maven executable not found at: C:\Users\john\mvn\apache-maven-3.5.3\bin\bin\mvn.bat

Seems like you set M2_HOME to C:\Users\john\mvn\apache-maven-3.5.3\bin. Try setting it to C:\Users\john\mvn\apache-maven-3.5.3 without the extra "\bin".

Doesn't make any difference

[08:14:02]org.apache.maven.shared.invoker.MavenInvocationException Error configuring command-line. Reason: Maven executable not found at: C:\Users\john\mvn\apache-maven-3.5.3\bin\mvn.bat

I'm running Windows 10, fully updated if that's any help. Using Oracle Java 8.

mschnitzler commented 5 years ago

The latest Maven releases come with a "mvn.cmd" - but no "mvn.bat". The quick fix might be to simply copy/rename the mvn file. However, this is just a local fix. There might be some older maven plugin in your project settings that is causing this issue.

pedanticdev commented 5 years ago

The latest Maven releases come with a "mvn.cmd" - but no "mvn.bat". The quick fix might be to simply copy/rename the mvn file. However, this is just a local fix. There might be some older maven plugin in your project settings that is causing this issue.

No difference. Downloading and using Maven 3.6 is the same error

[08:33:03]org.apache.maven.shared.invoker.MavenInvocationException Error configuring command-line. Reason: Maven executable not found at: C:\Users\john\mvn\apache-maven-3.5.3\bin\mvn.bat

My pom.xml file is

<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>com.pedantic</groupId>
    <artifactId>cdi-code</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.4.0.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <dependencies>

        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>8.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>fish.payara.arquillian</groupId>
            <artifactId>arquillian-payara-server-4-embedded</artifactId>
            <version>1.0.Beta3</version>
        </dependency>
        <dependency>
            <groupId>fish.payara.extras</groupId>
            <artifactId>payara-embedded-all</artifactId>
            <version>5.184</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>

        <finalName>cdi-code</finalName>

        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
        <testSourceDirectory>src/test</testSourceDirectory>

<!--        <plugins>-->
<!--            <plugin>-->
<!--                <artifactId>maven-compiler-plugin</artifactId>-->
<!--                <version>3.7.0</version>-->
<!--            </plugin>-->

<!--        </plugins>-->
    </build>

<!--    <profiles>-->
<!--        <profile>-->
<!--            <id>payara</id>-->
<!--            <activation>-->
<!--                <activeByDefault>true</activeByDefault>-->
<!--            </activation>-->
<!--            <build>-->
<!--                <plugins>-->
<!--                    <plugin>-->
<!--                        <groupId>fish.payara.maven.plugins</groupId>-->
<!--                        <artifactId>payara-micro-maven-plugin</artifactId>-->
<!--                        <version>1.0.1</version>-->
<!--                        <executions>-->
<!--                            <execution>-->
<!--                                <phase>package</phase>-->
<!--                                <goals>-->
<!--                                    <goal>bundle</goal>-->
<!--                                </goals>-->
<!--                            </execution>-->
<!--                        </executions>-->
<!--                        <configuration>-->
<!--                            <useUberJar>true</useUberJar>-->
<!--                            <deployWar>true</deployWar>-->
<!--                            <payaraVersion>5.191</payaraVersion>-->
<!--                        </configuration>-->
<!--                    </plugin>-->
<!--                </plugins>-->
<!--            </build>-->
<!--        </profile>-->
<!--    </profiles>-->
</project>
mschnitzler commented 5 years ago

I just created a minimal project using your POM. Unfortunately, I am not able to reproduce the error (running on Maven 3.5.2) - unless I misconfigure M2_HOME.

pedanticdev commented 5 years ago

After restarting my machine, it finally works. TIL that unlike Linux, I'll need to reboot the whole system for a change to an envar to take effect.

Thank you for your time.

On Thu, Apr 25, 2019, 08:56 mschnitzler notifications@github.com wrote:

I just created a minimal project using your POM. Unfortunately, I am not able to reproduce the error (running on Maven 3.5.2) - unless I misconfigure M2_HOME.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AdamBien/wad/issues/5#issuecomment-486580339, or mute the thread https://github.com/notifications/unsubscribe-auth/AGTJJJCDEHJUIE3JCWHRNM3PSFW2NANCNFSM4HHOXD3A .

rieckpil commented 5 years ago

I've updated my blog post about Adam's tool to have less confusion for further Windows devs (setting M2_HOME correctly): https://rieckpil.de/review-improved-java-jakarta-ee-productivity-with-adam-biens-wad-watch-and-deploy/

AdamBien commented 5 years ago

Reference to rieckpil's article in the new "articles" section added. This should help with Windows setup.