Maven creates an empty Pom.xml - maven-3

I'm trying to create Maven Project.
File - New Project - Maven. Archetype do not indicate.
Then everything is standard: GroupId and ArtifactId. The project is created with empty Pom.xml
Java installed:
java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Maven installed:
mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-
04T01:39:06+06:00)
Maven home: D:\Apache_Maven\bin\..
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_144\jre
Default locale: ru_RU, platform encoding: Cp1251
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

I don't know why you're seeing an empty pom.xml.
I can however offer an alternate solution:
Use the maven quickstart archetype (maybe from command line)
Import the resulting pom.xml into your project / create new project from the generated pom.xml.

Please check
your maven path is set correctly
https://www.tutorialspoint.com/maven/maven_environment_setup.htm
run mvn --version and check if your maven is pointing to write jdk as well
IF these two things set correctly while creating project " archetype" list show show . if it is still not showing that means there is a problem in your setup and maven will still show old version
ALso check Proejct->setting->Build deployment &Execution->maven shows correct path

Related

Jenkins: Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8

I am facing issue in jenkins job(jenkins running docker) Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
I have checked java version in docker it is openjdk version "11.0.12" 2021-07-20
we can solve this in Android Studio but how can we solve while running gradle build in jenkins.
Below is the error I am getting
Build file '/var/jenkins_home/workspace/CICDDemo_master/app/build.gradle' line: 2
What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.
In your Jenkins project choose the "configure" tab on the left side, then scroll down to "Properties Content" and write there:
JAVA_HOME=C:\Program Files\Java\jdk-11.0.12
GRADLE_USER_HOME=C:\

Java 8 version with an Ant/Jenkins build

I have a project that build with ant 1.9.4 and java 1.8.0_121 on machine A using Jenkins. But if I move the same project to a machine with the same versions of Ant and Jenkins but with java 1.8.0_131, my build fails.
Is there a way to make an ant build succeed with any Java 8 version without installing a different version of Java 8?
Thank you!
Since I am on a Linux RHEL, I had to increase the memory size configuration for JiBx in the /etc/security/limits.conf file.

build Grails 3 war with specific java compiler version

I am using IDEA 15. I have a grails 3 project setup. The app server I need to deploy to has Java Version 7. My local JDK is Java 8. I have set some properties in my build.gradle to use the target version 1.7.
apply plugin: 'java'
compileJava {
targetCompatibility = '1.7'
}
When I rebuild my project, it generates class files for 1.7, but when I run a maven war build from the IDEA menu, the classes are rebuilt and end up being Java 8 versions. I have set Java version in my project to 1.7 as well, but this did not help. How can I get to where I am producing a war file from my grails app that contains 1.7 versioned class files?
Thanks!
What are you using to build war file? "grails war" or "gradle war". Try to use gradle.

Switching between Java Runtime environments

I have both Java 6 and Java 7 installed in my computer running Windows XP sp3. I have entered path in the environment variables (PATH, JAVA_HOME) in My computer-> Properties. But when I give
java -version
I still get the following text
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build
1.7.0_09-b05) Java HotSpot(TM) Client VM (build 23.5-b02, mixed mode, sharing)
However, when I try
javac -version
I get
javac 1.6.0_03
How can I change the runtime from Java 7 to Java 6? When I compile my program in eclipse using ant, I get the following
Warning: java\util\List.class(java\util:List.class): major version 51
is newer than 50, the highest major version supported by this
compiler. [javac] It is recommended that the compiler be upgraded.
Path has the JRE first, thus the java -version and the JDK second, thus the javac -version. Check your PATH variable.
If you want the JDK version, put it first on the PATH.
If am not mistake java 7 windows installer of JDK or JRE will copy java.exe to some windows common path. I don't remember exactly the path but maybe C:\Windows\System32. Try this on command line to know where is the location of java.exe:
where java
Update your path precedence accordingly.
When you install Java (JRE), it copies java.exe into C:\Windows\System32, in addition to installation directory under C:\Program Files. But when you install full JDK (with compiler), it doesn't do that for javac.exe. When you have multiple versions of java, the last installed one will be called when you type java in command line.
Use full paths if you need to have multiple Java versions, you will always have problems trying to use unqualified java in command line. Alternatively, re-install JRE 7 - that will force default java to be V7.

How top set java 7 compiler at windows 7

I have installed java 7 on my machine.
java -version shows that:
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
javac -version showing
javac 1.6.0_10
When I am trying to build application using Ant it showing me error of "it is recommended that the compiler be upgraded"
How can I update path of javac to point java 7, my JAVA_HOME and PATH variable contain C:\Program Files\Java\jdk1.7.0_09 and C:\Program Files\Java\jdk1.7.0_09\bin respectively.
Try one of the following:
1) Change the PATH. Set JAVA_HOME before the windows paths. This is because under the windows folder, there is a java.exe that redirects to the last installed jre.
2) Regedit. The key HKEY_LOCAL_MACHINE->SOFTWARE->JAVASOFT->Java Runtime Environment contains the last installed version that the java.exe in the windows folder redirects to. If you change this to the version you want, everything should be ok.

Resources