Getting errors while generating WSDL via mvn command - eclipse

The location to my project is C:\Users\ess\workspace\myproject1. I tried to generate the wsdl file via the mvn command but this error appeared
The goal you specified requires a project to execute but there no pom in this directory c:\users\ess
and Maven home is c:\program files\apache-maven-3.1.0
Any idea?

You need to change to the directory where your pom.xml sits:
cd C:\Users\ess\workspace\myproject1
Make sure your pom.xml is located inside myproject1
Now run the maven command.
If still the error comes, please share your complete maven output.

the location where you are trying to execute the command is not the root directory of the maven project. Check whether at this location C:\Users\ess you have pom.xml, i don't think you have.
Now go to this location C:\Users\ess\workspace\myproject1 and try to run the same command again.

Related

Maven dependencies are downloaded but eclipse won't resolve them

A multi-module maven project will be buit successfully from the command line using mvn clean install and is loaded successfully in vscode without any compilation errors.
When the same project is opened in Eclipse (version Version: 2022-09 (4.25.0), Build id: 20220908-1902), I see compilation errors for dependencies not resolved for example:
The import com.ibm cannot be resolved
I tried everything to resolve this error, nothing worked, for example:
Update maven project
Project / Clean
Remove maven feature, delete the project, reimport, and convert back to maven
The strange thing is that if I delete the repository folder from <user-home>\m2.\repository and make a simple change to any pom.xml file, the entire repository folder is downloaded. Also, I located the JAR file using VSCode (ctrl-click) and I can see the related JAR logEnglish-1.0.jar in the local .m2 repository folder <user-home>\.m2\repository\logEnglish\logEnglish\1.0\logEnglish-1.0.jar.
The problem is that only Eclipse is reporting compilation errors and a lot or maybe all of the maven dependencies are not resolved. This is also affecting the debugging option and it breaks due to such compilation errors.
Another thing I noticed is that the Maven Dependencies folder is not showing on the Project Explorer no in Package Explorer, but I can see Maven Dependencies entry in Project Properties -> Configure Build Path -> Libraries.
Please help resolve this issue so that I can clear the compilation errors in Eclipse.
Update 1:
I created a simple parent/child pom with one inner module. I was able to reproduce the problem right away.
See attached snapshots for details.
The compile errors will show only when you open the parent project. If you open the inner module directly as a separate project, no compile errors will show and I can run and debug the project. However, if I try to debug the parent project, I will get a warning due to compile errors, and I can run the project only and only after I added the jar of the inner module to the classpath of the debug configuration. If I don't add the jar file, I will get this error Error: Could not find or load main class training.FirstProjectClass. The project is being built successfully using mvn clean install and that's why I can run the project. If I run mvn clean then I cannot run the parent project.
Also, notice how the maven dependencies folder will show if you open the inner project directly, but, it won't show if you open the parent project.
In addition, I noticed if I add the inner project to the classpath of the debug config then it works also without building the project and without generating the jar file using mvn clean install.
Based on the above, the problem boils down to:
How we can resolve the dependencies of the inner modules when you open the project using the parent maven project?
If we can resolve the errors, then we can run without seeing the warning, and we have the assurance that the project is clear before running the mvn clean install command.

Angular portlet throws exception path does not start with a "/" character

On Liferay github there is sample portlet which uses Angular https://github.com/liferay/liferay-blade-samples/tree/master/gradle/apps/npm/angular-npm-portlet
I've created my own portlet using maven command mvn archetype:generate -Dfilter=liferay
choose: 12
and after that I've built it and deployed to tomcat and exception was thrown:
07:29:02,097 ERROR [http-nio-8080-exec-2][ComboServlet:89] java.lang.IllegalArgumentException: Path samplePortlet#1.0.0.js does not start with a "/" character
any idea how to fix this ?
I guess that you run the generate command and then you try to do mvn clean install. The error is a cryptic one but one of the cases that you can get it is when the combo servlet can't find the dependency in the jar file. There is not yet a maven wrapper for the npm functionality.
You can do 2 things.
Without gradle:
mvn clean install
npm run build
copy the js from build folder into the target folder. cp -R build/resources/main/META-INF/resources/ target/classes/META-INF/resources/
mvn install (don't clean!)
With gradle:
gradle build
Few remarks:
If you want to work with the npm stuff I suggest that you go for Liferay workspace, blade tools and Gradle combinations. It works smoother.
When you create the project with the archetype you might need to fix the ID for the component. In the JS code will contain something with the artefact name - root but the actual id in the JSP will probably be just namespace.

Download failed. Obtain the jar manually and place it at ./.lib/0.12.2/sbt-launch.jar

I'm trying to run ./sbt file it throw an error
Detected sbt version 0.12.2
Starting sbt: invoke with -help for other options
Downloading sbt launcher 0.12.2:
From http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.12.2/sbt-launch.jar
To ./.lib/0.12.2/sbt-launch.jar
Download failed. Obtain the jar manually and place it at ./.lib/0.12.2/sbt-launch.jar
I was manually sbt-launch.jar placed in ./.lib/0.12.2/ directory then its working fine.
./.lib/0.12.2/sbt-launch.jar

Eclipse not downloading the apache jars from pom.xml

I am using Eclipse as my IDE and want to build a maven program, but I see that neither my maven clean or maven install is working
For maven clean,I get the error:- "Failed to parse plugin descriptor for
org.apache.maven.plugins:maven-clean-plugin:2.4.1 "
I also tried the help mentioned in the link
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/PluginDescriptorParsingException
but it is not helping
Also my maven install is not working,it shows the following error:
] Failed to parse plugin descriptor for org.apache.maven.plugins:maven-resources-plugin:2.5
I had tried all the approaches mentioned in similar issues which include deleting the directories u nder .m2 folder, deleting .m2 folder, re-installing apache-maven on my system but nothing is working.
And when I run the same maven program under intelliJ, I could see the jar names but when I click on them it shows no contents which means they are not getting downloaded properly...'
So not able to work on my java maven project.Please help.
what is the fix for such environmental issues.
Even I tried re-installing eclipse, intelli J but nothing helps.
The issue got resolved by following the steps mentioned at:
https://issues.sonatype.org/browse/MVNCENTRAL-299
try to download appropriate maven version from https://maven.apache.org/download.cgi. and follow installaion steps mentioned.
set the "M2_HOME" and "MAVEN_HOME" as environment variables pointing to maven installation directory.restart your machine.
set the maven settings in eclipse through preferences tab.

Unable to reimport Grails project into GGTS / STS?

I have copied a grails project to the workspace folder -
and try to import. The following error is shown:
Invalid project description.
OK
C:\Users...\workspace-ggts-3.5.1.RELEASE\ overlaps the location of another project: ''
How can I can clean the workspace correctly (delete the project properly) so that this message does not appear? I did ensure that the project name under .projects did
not exist prior to import - but message still indicates an overlap?
I then open project and Run As Grails Command (run-app).Grails home is set to: C:\grails-1.3.7\ -
and get
Base Directory: C:...
Resolving dependencies...
Dependencies resolved in 470ms.
C:... does not appear to be part of a Grails application.
The following commands are supported outside of a project:
add-proxy
clear-proxy
create-app
create-plugin
help
list-plugins
package-plugin
plugin-info
remove-proxy
set-proxy
Run 'grails help' for a complete list of available scripts.
Note that I had imported the project successfully before (as a Grails project) and
have deleted since etc.
I have also tried moving to other folder which I do not want to do.
How can I resolve the above?
Thank you
Simon