Having problem creating maven artifacts in solr on Windows 7 - java

I'm trying to build solr 4.0 snapshot in maven. Here are my steps:
Check out solr in d:\workspace\solr
download ant, unzip to d:\ant. set the ANT_HOME to d:\ant
download maven-ant-tasks-2.1.3.jar (the latest version) to d:\ant\lib
in commandline, go to d:\workspace\solr\lucene
run command:
ant generate-maven-artifacts
it gives the error:
D:\workspace\solr\lucene\common-build.xml:326: #
##########################################################################
Maven ant tasks not found.
Please download the Maven ant tasks JAR (maven-ant-tasks-2.1.1.jar)
from http://maven.apache.org/ant-tasks/download.html and add it to your
$HOME/.ant/lib/ directory, or to your $ANT_HOME/lib/ directory, or
to your $CLASSPATH, or add "-lib /path/to/maven-ant-tasks-2.1.1.jar"
to the ant command.
##########################################################################
Total time: 0 seconds
I tried running:
ant -lib d:\ant\lib generate-maven-artifacts
it's the same error.
running ant alone will build solr without problem.
Environment setting:
D:\workspace\solr\lucene>ant -version
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
D:\workspace\solr\lucene>mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
Java version: 1.6.0_24
Java home: C:\Program Files (x86)\Java\jdk1.6.0_24\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows"
Can any one help? Thanks.

I think you need to run ant like this:
ant -lib d:\ant\lib\maven-ant-tasks-2.1.1.jar generate-maven-artifacts
Classpath adds need file references (not directory references). You can also add it like so:
SET CLASSPATH=%CLASSPATH%;d:\ant\lib\maven-ant-tasks-2.1.1.jar
ant generate-maven-artifacts

Related

Jenkins with mvn missing dir error

I've created jenkins job which need to build something very simple
Clone this repo
https://github.com/g0t4/jenkins2-course-spring-boot
cd to project
https://github.com/g0t4/jenkins2-course-spring-boot/tree/master/spring-boot-samples/spring-boot-sample-atmosphere
and run mvn compile
inside the atmosphere there is a pom.xml file, so what could be the reason to no finding it ?
I've configure the task like following
The error in the log is:
Checking out Revision 4bde91e33e2860b2aab142028c04eff37b7791f2 (refs/remotes/origin/master)
git config core.sparsecheckout # timeout=10
git checkout -f 4bde91e33e2860b2aab142028c04eff37b7791f2
Commit message: "Adding in jacoco code coverage"
First time build. Skipping changelog.
[atmo_local] $ mvn -f spring-boot-samples/spring-boot-sample-atmosphere/pom.xml complie
FATAL: command execution failed
java.io.IOException: error=2, No such file or directory
update
When I click on my mac mvn -v I get
Apache Maven 3.3.9 (bb52d2b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T18:41:47+02:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.2", arch: "x86_64", family: "mac"
update 2 this is the global configuration
I've installed the latest jenkins with maven plugin . this is not sufficient ?
No, it's not. You have to also configure Maven location to jenkins.
The steps are something like:
Click Manage Jenkins
Click Global Tool Configuration
In the JDK section click Add JDK button, uncheck Install automatically checkbox and enter Name and JAVA_HOME values to point to right locations
In the Maven section click Add Maven button, uncheck Install automatically checkbox and enter Name and MAVEN_HOME value (whatever it is in your jenkins system)
Click Apply and then Save

Error: Could not find or load main class $MAVEN_HOME

while running maven clean I am getting the following error :
Error: Could not find or load main class $MAVEN_HOME
while doing mvn -version I got :
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:4
7+05:30)
**Maven home: D:\mavenSecurity\apache-maven-3.3.9\bin\..**
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_79\jre
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
I have set MAVEN_HOME = D:\mavenSecurity\apache-maven-3.3.9 in user variable in environment setting
Path in system variable in environment setting : D:\mavenSecurity\apache-maven-3.3.9\bin
Since I am getting other error previously so I have done the following also as mentioned in this post:
Eclipse error setting up Maven project for class exercise: Check $M2_HOME environment variable and mvn script match
-Dmaven.multiModuleProjectDirectory=$MAVEN_HOME
I have consulted other links but still I am getting the error while running MAVEN CLEAN in eclipse juno
This worked for me with the 3.3.9 version. The only difference is :
1) Add both M2_HOME and MAVEN_HOME variables in the Windows environment, and point it to your Maven folder (Note: I have added it to system variables)
2) Update PATH variable, append Maven bin folder – %M2_HOME%\bin, so that you can run the Maven’s command everywhere
Post output of mvn –version again if you face the issue. Also try running mvn clean from the command line and post the results.
configuring Maven on Eclipse. you have to tell eclipse where Maven has been installed so that it can use the Maven installation to build our projects.
Win 7 64 . Here is how i did my config.

Change JDK in IntelliJ seems not working

I'm on Windows, I've already set the Path to JDK 1.8 in Environment Variables.
Also in Project Structure, I've already changed to it. I have a Maven project.
On command line, if I use `mvn --version' I see
Apache Maven 3.0.4 (r1232337; 2012-01-17 15:44:56+0700)
Maven home: C:\apache-maven-3.0.4
Java version: 1.8.0_77, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_77\jre
Default locale: en_AU, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
However, in IntelliJ, if I hit the Run button, it always points to JDK 1.7, and an error is thrown (since my maven project requires java 8). How do I change that? Thanks
"C:\Program Files\Java\jdk1.7.0_09\bin\java" -Xms512m -Xmx1024m -Dclassworlds.conf=C:\apache-maven-3.0.4\bin\m2.conf -Dmaven.home=C:\apache-maven-3.0.4 -Didea.launcher.port=7534 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 11.1.5\bin" -Dfile.encoding=UTF-8 -classpath "C:\apache-maven-3.0.4\boot\plexus-classworlds-2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 11.1.5\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher --no-plugin-registry --fail-fast --strict-checksums --update-snapshots -f C:\Users\Tung\server-pinbike\api-pinbike2\pom.xml install
Update
After following #BevyQ tip, I found that the JRE of Maven runner was pointing to Jre7, that's the reason.
See screenshot below, hope it helps someone.
Have you checked your modules settings?
In Project Structure, click Modules->"Your modules"->Dependencies to see what SDK you are using.
And you should check the Run configurations too.
I am able to repo your scenario by setting the Project SDK to 1.7 then set them module SDK to 1.8.
The version you got by using commend line, is the version that windows is using. It doesn't mean that version is applying to you project or your module in IntelliJ.
So, please double check if you set both project and module's SDK to 1.8.
Below are some screen shots of my repo.
I set module SDK to 1.8. And set Project SDK to 1.7
Mvn version is 1.8. But it will using 1.7 when I run the project

Perform command does not work in Spring Roo

When running the 'perform tests' command in Roo I get the following error:
createprocess error=2,the system cannot find the file specified.
Now, all the posts on the net suggest that maven should be in PATH. I did that, I rebooted, my maven installation path is in there along with my roo path and java path. I have ROO_HOME set, JAVA_HOME and M2_HOME.
The versions I use are:
Maven: 3.3.1
Roo: 1.3.1.RC1
Java: 1.8.0_45
When I run Maven from the commandline i get this:
X:\...>mvn -v
Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-13T21:10:27+01:00)
Maven home: X:\apache-maven-3.3.1
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: X:\Java\jdk1.8.0_45\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
Maven seems to be fully functional.
I also can start the roo console from the commandline:
X:\...> roo
1.3.1.RC1 [rev 4877cfb]
Welcome to Spring Roo. For assistance press CTRL+SPACE or type "hint" then hit ENTER.
roo> perform tests
CreateProcess error=2, The system cannot find the file specified
roo>
So my question is, does anybody know if this is a bug? Because I'm under the serious impression that it is. Posts that 'supposedly' solve this problem are 2y or older.
Thanks for the help!
Got the same problem.
Roo is searching for mvn.bat file in the maven's bin directory, but in the version 3.3.1, there is mvn.cmd only.
Try either renaming the mvn.cmd to mvn.bat in your maven bin directory (worked for me), or use older version of maven, for example 3.0.4.
Thanks for the suggestion! Instead of renaming though, if you use a recent version of Windows (10 in my case) you can create a symlink as well. Open admin command prompt > navigate to your maven bin folder > and execute the command:
mklink mvn.bat mvn.cmd
hint: I also do this if I need to swtich between maven versions, pointing my m2_home to a symlink and just switching the symlink when needed to point to the right place.

Netbeans Maven project: JAVA_HOME is not defined correctly

I have a NetBeans Platform project build with Maven2. When I try to create a new platform module I get this strange error:
cd ~/src; JAVA_HOME=/usr/lib/jvm/jdk1.7.0/bin/java ~/netbeans-7.3/java/maven/bin/mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes...
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/lib/jvm/jdk1.7.0/bin/java/bin/java
In ~/.bashrc I have definition of JAVA_HOME:
export JAVA_HOME="/usr/lib/jvm/jdk1.7.0"
export JDK_HOME="/usr/lib/jvm/jdk1.7.0"
There's no slash at the end, however maven appends /bin/java/bin/java to this path. I can build already existing module with Maven without problems, just when creating a new one it fails. Where does Maven get this JAVA_HOME?
EDIT:
maven settings:
$ mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.7.0_17
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "3.2.0-39-generic" arch: "amd64" Family: "unix"
You're redefining JAVA_HOME on the command line to point to /usr/lib/jvm/jdk1.7.0/bin/java, which is wrong:
cd ~/src; JAVA_HOME=/usr/lib/jvm/jdk1.7.0/bin/java ...
Remove the JAVA_HOME=/usr/lib/jvm/jdk1.7.0/bin/java from the command line:
cd ~/src; ~/netbeans-7.3/java/maven/bin/mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes...
netbeans takes the JAVA_HOME from the definition of the Java Platform in the IDE (See Tools/Java Platforms)
unless you select a custom platform, IDE uses the default one which is the one the IDE is running on.
All platforms need to be defined in the Tools/Java Platforms dialog and validation checks are in place to select the right folder.
Maybe something changed in time for you and the definition there is not correct?
the problem was with incorrect definition of JAVA_HOME in ~/.bash_profile
NetBeans integration of maven prefers:
System.getenv("JAVA_HOME")
before:
System.getProperty("java.home")
for linux find the mvn executalble file under netbeans's java/maven/bin folder and add
from="/bin/bin/java"
to="/bin/java"
JAVACMD="${JAVACMD/$from/$to}"
before the lines
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly."
cheers

Categories

Resources