Unable to install Maven on Windows: “JAVA_HOME is set to an invalid directory”

The problems are to do with your paths. Make sure that the directory “E:\java resources\apache-maven-2.2.0\bin” is on your command search path. Make sure that the JAVA_HOME variable refers to the home directory for your Java installation. If you are executing Java from “E:\Sun\SDK\jdk\bin”, then the JAVA_HOME variable needs to point to “E:\Sun\SDK\jdk”. NB: JAVA_HOME should … Read more

How to get the Maven local repo location?

If you want just the local repo, try this: mvn help:evaluate -Dexpression=settings.localRepository | grep -v ‘\[INFO\]’ EDIT I’m revisiting this after years because recent versions of the Maven help plugin introduced a useful parameter for the evaluate goal called forceStdout that allows us to remove the need to grep the output: mvn help:evaluate -Dexpression=settings.localRepository -q … Read more

How to deploy SNAPSHOT with sources and JavaDoc?

<build> <plugins> <plugin> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <id>attach-sources</id> <phase>deploy</phase> <goals><goal>jar-no-fork</goal></goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-javadoc-plugin</artifactId> <executions> <execution> <id>attach-javadocs</id> <phase>deploy</phase> <goals><goal>jar</goal></goals> </execution> </executions> </plugin> <plugin> <!– explicitly define maven-deploy-plugin after other to force exec order –> <artifactId>maven-deploy-plugin</artifactId> <executions> <execution> <id>deploy</id> <phase>deploy</phase> <goals><goal>deploy</goal></goals> </execution> </executions> </plugin> </plugins> </build> See Sonatype’s OSS parent POM for a complete example.

Maven2: Best practice for Enterprise Project (EAR file)

You create a new project. The new project is your EAR assembly project which contains your two dependencies for your EJB project and your WAR project. So you actually have three maven projects here. One EJB. One WAR. One EAR that pulls the two parts together and creates the ear. Deployment descriptors can be generated … Read more

What is the difference between “mvn deploy” to a local repo and “mvn install”?

Ken, good question. I should be more explicit in the The Definitive Guide about the difference. “install” and “deploy” serve two different purposes in a build. “install” refers to the process of installing an artifact in your local repository. “deploy” refers to the process of deploying an artifact to a remote repository. Example: When I … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)