Deployed Maven Attached Artifacts on Github Remain Inaccessible - maven

I have a maven module which is configured with a feature packaging (an Apache Karaf feature). This project has no primary artifact to deploy but an attached feature.xml file. When I try to deploy the project to Github package the upload seems to work:
Uploaded to github: https://maven.pkg.github.com/cdelg-ct/repo/com/mycompany/app/my-mod/1.0-SNAPSHOT/my-mod-1.0-20200701.090836-1-features.xml
But then, the above file does not show up in the Github Packages UI and other projects cannot depend on it (Could not find artifact). Note the pom is well deployed as the other sibling jar modules.
Did anyone manage to get classifier to work with Github Maven Packages?

You are using a SNAPSHOT version.
By default, SNAPSHOT versions are not fetched.
Quick way to check it, try a release version.
If it works, you have to configure your maven settings to allow spapshots versions.

Related

Missing Maven Repositories node in Services tab in Netbeans

Maven is installed on my computer and Netbeans can find it because I can create a new project from Archetype just fine. However, I need to add some repositories on Maven but I don't know any other way other than the one in the services tab, but for some reason, the Maven Repositories node in the services tab had gone missing (it was there before). I tried restarting netbeans and closing the services tab and opening it again. Is there any other way to add repositories to Maven or have the Maven Repositories show up again?
I am using Apache Netbeans 12.
Thanks.
Edit:
I attached a screenshot of the specific problem. I have Maven correctly installed and can create a new project. But I can't add a new archetype catalog because "Maven repositories" is missing:
After checking the suggestion of #skomisa, the log showed that the error is caused by me adding a repository that is unavailable. How do I remove this repository since the "Maven Repositories" option is unavailable in services? Thank you.
NetBeans is coming with bundled version of Maven. So when you've installed maven and NetBeans is able to create a new project. It does not mean NetBeans is using our installed version of Maven.
When you add a repository to the services tab it already mentions:
Adding a repository here doesn't affect your Maven builds in any way.
It's only used to provide the IDE with information from the repositorie's index
Since you haven't described what you want with that repository I assume that it's needed to retrieve artifacts from that repo. So most likely you need to add the repo to your project's pom.xml in the <repositories> section.
I solved the problem by reinstalling Netbeans and deleting the cache in C:\Users<user>\AppData\Local and Roaming.

Which artifacts are uploaded by default gradle maven?

I cannot find in gradle docs which artifacts are uploaded by default. Is it so, that only compilation artifacts are uploaded? I have a case where I'm left with multiple jars in workspace after build process and I wanted to make sure that no garbage is uploaded.
I found info that in case of multiple artifacts I can define addFilter() but what about main artifact upload? How gradle determines which jar is uploaded by default?
I'd appreciate clear information and if someone could point me to documentation that I missed.
I cannot find in gradle docs which artifacts are uploaded by default
Gradle does not upload anything for you. You must configure whatever publishing plugin you are using with the artifacts you want published.
The official publishing plugins are:
Maven Publish
Maven Plugin (deprecated)
Neither of these plugins publish anything by default.
I have a case where I'm left with multiple jars in workspace after build process
This is normal. However, if you are seeing artifacts that should not created, then you'll need to audit your Gradle build to see how that artifact is being created and disable it if needed.
There is (1) official Gradle plugin that I am aware of that does configure the above plugins to publish an artifact. This is documented on at the very bottom here: https://docs.gradle.org/current/userguide/java_gradle_plugin.html

How to build Liferay 7 WSRP module?

I am trying to build Liferay 7 wsrp module from Liferay GitHub repository.
I couldn't build entire Liferay source, is it possible to build this wsrp module only ?
If anybody has a jar file working on Liferay 7 CE ga2 or ga3, please share.
Important Edit:
You don't actually need to rely on the Liferay Portal jars for most modules. The reason this one failed as it did was that simply running gradlew deploy in modules/apps/wsrp will automatically include all subprojects, which includes wsrp-test. The "-test" modules rely on the com.liferay.portal.test-integration artifact.
However, if you add the option -Dbuild.profile=portal to your command, the Gradle wrapper liferay-portal will only include modules that contain the .lfrbuild-portal marker file, which all of the wsrp modules have except for wsrp-test.
Original Post:
Liferay has a Maven repository that hosts their public artifacts.
Their portal artifacts can be found here: https://repository.liferay.com/nexus/content/groups/public/com/liferay/portal/
However, if you're building a module from the source in their Git repo, the latest release/snapshot on the Maven repo might be out of date. Snapshots are updated fairly frequently, but this is still a possibility. The safest thing to do is to just compile the portal from source.

Maven hosting with Bintray

I am having issues with hosting maven jars with Github (site-maven-plugin) so I want to move with Bintray asap.
What are the steps to host a existing maven jar in bintray?
Here is my error when doing: mvn releae prepare
Caused by: org.apache.maven.shared.release.ReleaseFailureException: You don't have a SNAPSHOT project in the reactor projects list.
What I have now is I can do mvn clean install with no problems at all. Can I just upload the files under ./m2 repo? I basically uploaded the .jar and .pom I found in the maven repository.
How can I access the library I uploaded on Bintray from my pom.xml?
You can get started with publishing from Maven to Bintray by copy-pasting some pom parts from "Set Me Up" guide:
Full user manual is available as well.
Please note, that you can't upload SNAPSHOTs to Bintray. It's a distribution platform and it is not intended for development process.
Saying that, you are welcome to take advantage of a free Artifactory account for hosting your snapshot during development.
Using OJO you don't need to use the troublesome Maven Release Plugin anymore. Once you're satisfied with the snapshots quality you can promote them to be releases and upload them to Bintray in one REST call (or click of a button in Jenkins),

How to enable inside glassfish access to maven repository?

I have a following problem. We have a central maven repository hosted on our company server. Our team is working on a project. Everyone here uses that repository to get the required artifacts. If something is missing at the moment and is required for the task that the developer is currently dealing with, he installs this artifact manually to the central repository, so that his commits don't break the automated builds.
Now, each developer also has Glassfish v2 installed on his machine. That is for testing and debugging purposes. Before committing the changes, developer makes the .ear for the project with Maven help. However, after the developer deploys the ear to it's local glassfish, frequent errors arise, because the set of glassfish libraries may not contain all the latest dependencies of the central company repository.
Right now in case of the error the developer simply reads the log and looks what exactly is missing. After that he manually copies the required jar inside his local $GLASSFISH_HOME$/lib dir. But that seems a little bit frustrating. How can this be done automatically?
Right now we are trying to implement the following solution. The developer has to synchronize his local maven repository gathering all the artifacts from the central one that are required by the project. This local repository has to be placed on the java classpath, so that glassfish would also see it. Is that a correct approach? Maybe there is a way to install directly all the required artifacts from the central repository inside $GLASSFISH_HOME$/dir and this can be done automatically during deploy?
About having to install dependencies. If the developers need to install dependencies missing from public maven repositories, take into account that usually maven proxies have the ability to cache public repos. For instance, archiva has a proxying cache. If the dependencies are your own project deliverables you should consider releasing and deploying with maven to your company repo.
About latest versions. You need to specify maven what version of dependencies should use. I would prefer editing my poms manually, anyway there's a variety of ways to achieve that.
The libraries should be part of the project, I think. If not standard libraries of glassfish, they should be included, for instance, in your war file as part of your project. If not standard but not part of your project (not the regular approach) consider managing this glassfish as a project on its own (own git/svn repo, own pom, own versions, own everything).
Good luck.

Resources