Unable to build maven project, pom.xml file not found - maven

We recently lost (i.e they died after SAN failure) build VMs for an inhouse application. Unfortunately, these VMs were never backed up.
The devs that set this environment up have moved on and now I'm trying get these VMs going again as mods are required to this inhouse application. I'm a sys admin not a developer and this is proving harder than I thought...
The VMs that died were a TeamCity server and an Artifactory server.
I've built a new VM with both TeamCity and Artifactory (it should be lightly loaded enough to handle it). I have TeamCity talking to the git repo but when I try and build the project, I get
Non-readable POM /srv/teamcity/10.0.4/buildAgent/work/b20d5a085d491430/webview/pom.xml: /srv/teamcity/10.0.4/buildAgent/work/b20d5a085d491430/webview/pom.xml (No such file or directory)
Looking on the file system, indeed there is no pom.xml file at /srv/teamcity/10.0.4/buildAgent/work/b20d5a085d491430/webview. There is however a pom.xml file in /srv/teamcity/10.0.4/buildAgent/work/b20d5a085d491430.
Any pointers on how to get Maven to look one directory up for this file?
Thanks
Edit:
Apologies all, I just found that I hadn't correctly defined the "VCS Root", I done that now and am getting further although the project still doesn't build. I'll poke it some more and see how I go.

I just found that I hadn't correctly defined the "VCS Root".

I faced similar issue. Solution is: Please check the module name in parent POM and child pom, both name should be same.

Adding to that Teamcity build using maven thrown me same kind of error with the below message
The project (/opt/buildagent/work/d1df6864f98d2599/pom.xml) has 1 error
Non-readable POM /opt/buildagent/work/d1df6864f98d2599/pom.xml: /opt/buildagent/work/d1df6864f98d2599/pom.xml (No such file or directory)
for me it solved by creating VCSRoot configuration

Related

Gradle could not resolve org.springframework.vault:spring-vault-core

I have a project that adopts Spring Vault to fetch credential. Dependencies of the project are as following and build.gradle file is generated automatically afterwards.
When I build the project I got the error
Could not resolve
org.springframework.vault:spring-vault-core:2.2.2.RELEASE.
Possible solution:
Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I have checked the libraries by going to the Project Structures and got the weird thing
The weird thing I mean here is about the path of the jar file. It should be something like
%GRADLE_HOME%\caches\modules-2\files-2.1\org.springframework.cloud\spring-cloud-vault-config\2.2.3.RELEASE\5fd5a06deb01db77eb3e9b8e723ccc1e0790c420
How can I fix this issue in IntelliJ?
When you get an error about could not resolve dependencies in gradle, then there are several things you need to check.
Proxy settings (should be inside gradle.properties)
Permission for creating directories (particularly in %GRADLE_HOME%\caches\modules-2\files-2.1)
For the problem of proxy setting, simply set values for the following fields inside gradle.properties
systemProp.http.proxyHost=
systemProp.http.proxyPort=
systemProp.http.nonProxyHosts=
systemProp.https.proxyHost=
systemProp.https.proxyPort=
systemProp.https.nonProxyHosts=
For the problem of permission, try creating directories with the name of dependencies cannot be resolved, for example, org.springframework.vault at %GRADLE_HOME%\caches\modules-2\files-2.1. If you got permission denied or simply cannot create, then please contact your IT support!

maven directory not found in Jenkins?

I am doing auto deployment of Java Application using Maven and Jenkins, but it is getting failed.Here is the console output:
I have set the environment varaibles and also downloaded and configure all the required plugins. Need help to solve this issue.
Thanks
First of all: Please copy/paste messages instead of using images.
Secondly, the message said that you probably misconfigured the directory for the settings.xml. The settings.xml is usually in the directory .m2 in the user directory, but it can also be supplied from somewhere else.

Mule - [WARNING] MULE_HOME is not set - displayed when building with Maven

I'm trying to deploy a Mule application to Standalone using Maven, but Maven is unable to move my app to the relevant apps folder and I'm given the following warning:
[WARNING] MULE_HOME is not set, not copying <app-name>
However, MULE_HOME is set, and a simple echo $MULE_HOME in Terminal gives the following, which is correct:
/opt/mule
Is there a known fix to this? Currently having to manually copy to the apps directory.
Ok, I've figured out where the issue was here. My standalone instance of Mule is in a directory /opt/mule-standalone-3.4.0 with an alias /opt/mule pointing to the same location. For some reason, Maven didn't like MULE_HOME being set to the alias. When amended to point to the actual directory, all worked fine.

how to force maven to update local repo

I compiled a jar file in one project so it can be consumed in the 2nd one. I can see the jar file in .m2 folder. But in the 2nd project it complains about artifact not found.
I guess I have to force maven to update indices/cache something but don't know what exactly. Any tip, thanks.
Update: thanks for all good suggestions.
Turns out that the maven plugin (of IntelliJ) in the second project doesn't update its index. I use command line it compiled ok.
try using -U (aka --update-snapshots) when you run maven
And make sure the dependency definition is correct
You can also use this command on the command line:
mvn dependency:purge-local-repository clean install
If you are installing into local repository, there is no special index/cache update needed.
Make sure that:
You have installed the first artifact in your local repository properly. Simply copying the file to .m2 may not work as expected. Make sure you install it by mvn install
The dependency in 2nd project is setup correctly. Check on any typo in groupId/artifactId/version, or unmatched artifact type/classifier.
Even though this is an old question, I 've stumbled upon this issue multiple times and until now never figured out how to fix it. The update maven indices is a term coined by IntelliJ, and if it still doesn't work after you've compiled the first project, chances are that you are using 2 different maven installations.
Press CTRL+Shift+A to open up the Actions menu. Type Maven and go to Maven Settings. Check the Home Directory to use the same maven as you use via the command line
Click settings and search for "Repositories", then select the local repo and click "Update". That's all. This action meets my need.
If you are struggling with authenticating to a site, and Maven is caching the results, simply removing the meta-data about the site from the meta-data stash will force Maven to revisit the site.
gvim <local-git-repository>/commons-codec/resolver-status.properties

tycho-p2-repository-plugin fails with "No content specified for p2 repository"

I am trying to build a p2 repository using Tycho and the tycho-p2-repository-plugin in an eclipse-repository packaging type. When I run the build, it is giving me the following exception:
Failed to execute goal org.eclipse.tycho:tycho-p2-repository-plugin:0.13.0:assemble-repository (default-assemble-repository) on project com.mycompany: No content specified for p2 repository
Can someone point me to the cause of this problem?
You need either of the following files in the root of the eclipse-repository project:
A category.xml files with at least one feature referenced in it
A *.product file
These files define what should be included in the p2 repository, so if there is none of these, the p2 repository would be empty. This is probably not what you wanted, so Tycho fails the build. (Admittedly, the error message could be more helpful...)
I had this problem too, unfortunately it was one of many problems and I do not remember which thing I did to fix it.
Make sure you are using 0.14.1 of tycho.
My working version is a very empty pom.xml, much like Packaging Types
I have not needed to configure the eclipse-repository via tycho-p2-repository-plugin.
Do you have a valid target definition defined in your reactor build somewhere?
Is your *.product file valid? The product file needs to be in the same directory as your eclipse-repository pom, I think it gets found via black magic.
Also make sure your product feature is separate from your eclipse-repository.
under PDE builds you could have the *.product file and the with the feature that is the root for your product.

Resources