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

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.

Related

How to download dependencies using Bazel?

I am new to Bazel. I need to download external dependency jar files using Bazel. Where to configure to download external jar files. I tried to add jar files in BUILD and WORKSPACE files , but not working.
Workspace file
maven_server(name="myserver",url="https://mvnrepository.com/artifact/org.apache.flink/flink-java")
maven_jar(name="flink-java",artifact="org.apache.flink:filnk-java:jar:1.2.0",server="myserver")
bind(name="flink-java",actual="#flink-java//jar")
Build file
java_binary(
name="read_files",
srcs = glob(["ReadFiles.java"]),
main_class="com.ibm.cdo.gts.contracts.pipeline.preprocess.ReadFiles",
deps=["//external:flink-java"],
)
The logical mistake you have there is that the workspace name (flink-java) is illegal see here and here. What is needed is to change the - to _ in maven_jar and of course the reference in the bind.
maven_jar(name="flink_java",artifact="org.apache.flink:flink-java:jar:1.2.0")
bind(name="flink-java",actual="#flink_java//jar")
Two more mistakes you had in the above were:
In the artifact coordinates you wrote filnk-java when you needed flink-java
The mvnrepository URL you used doesn't seem to be legal. I tried a few variants but couldn't get it to work. Additionally from the site they seem to link downloads to Maven Central itself so I'm not sure they server the jars. Having said that since Bazel fallbacks to Maven Central I just omitted the maven_server and the build passes. If you need help with the maven_server part and you need to use a private Maven repository please double check the URL first.
PS: It would have really helped if you added to your question the Bazel outputs since I needed to create my own workspace to know what were the problems you encountered.

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

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

Tycho missing plugin when building an update site

When I build my project by tycho-maven-plugin, I encounter the following message:
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: foo-updatesite raw:0.2.0.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):0.2.0-SNAPSHOT
[ERROR] Missing requirement for filter properties ~= $0: foo-feature.feature.group 0.2.0.qualifier requires 'foo-plugin 0.0.0' but it could not be found
[ERROR] Cannot satisfy dependency: foo-updatesite raw:0.2.0.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):0.2.0-SNAPSHOT depends on: foo-feature.feature.group [0.2.0,0.2.1)
This error occurs when building an update site. Plugin and feature are build normally. I build the update site from PDE without issues.
The project structure is common: there is a parent project with pom packaging and three modules: plugin, feature and updatesite. Of course, I invoke mvn clean package from the parent project.
What can be the reason for this error? How can I debug it?
UPD: I tried many things: removed "grandparent" pom, removed SNAPSHOT/qualifier, played with configuration. However, I found the solution: I switched to tycho 0.19 instead of 0.21. So I suppose there is a bug in tycho 0.21.
The error message
Missing requirement for filter properties ~= $0
indicates that you have defined an environment filter when you include the plugin foo-plugin in the feature.xml. However this does not explain the dependency resolution error you are seeing. The only way I can reproduce the error message is by adding an Eclipse-PlatformFilter header in the manifest of the plugin using a value which doesn't match environments configuration in the POM.
I had the same error message:
Missing requirement for filter properties ~= $0: foo-feature.feature.group 0.2.0.qualifier requires 'foo-plugin 0.0.0' but it could not be found
For some reason this error (also) means, that foo-plugin is present... twice.
So in your case, open the "Content" tab of the "Target Editor" and make sure that foo-plugin is not present in two distinct versions. I common way this could happen is if two features contain the same bundle.

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

Referencing binaries from one project in another

Newbie question : I have 2 C# projects in TeamCity, call them A and B. A contains a reference to B.dll. B builds fine. However, A fails to build because it cannot find B : Could not locate the assembly "B"
It seems really simple : how do I tell my project A on the buildserver where to find the binaries from B\bin\Release?
You do this by creating 'Artifacts' and artifact dependencies.
If project A is dependent on project B, then you create an Artifact on project B using an artifact path like so:
bin/Release/B.dll
Then on project A you setup a artifact dependency on B with path like:
B.dll
And set the destination path to be where ever project A is expecting to find B.dll e.g.
./Libs
You can do other cool stuff like automatically archiving all your artifacts into a zip by using the syntax:
bin/Release/*.dll => B.zip
and access them via:
B.zip!B.dll
All these paths are relative to build directories so makes it easy and you dont need to worry about the TeamCity guid folders or use absolute paths.
The problem you're encountering is that Teamcity runs each build in it's own temporary directory and since this is a randomly generated name you can't set a reference directly from one to the other.
Typically you would write a build script that builds both A and B in the right order and just have Teamcity run that build script. (Since you're using C#, MSBuild is ideal for this).
The alternative would be to have B.dll copied to a known location (e.g. c:\currentbuild) at the end of its build and have A always reference it from here. You can set up build dependencies in Teamcity so that if B is rebuilt, A is also rebuilt.

Resources