Is it possible to make gradlew to work with nexus? - nexus

I have a build machine for Android app. This machine has no access to the Internet.
There is a local nexus repository. Application gradle set up to load dependencies from this nexus repository and it works fine.
But I also need gradlew to load from that nexus repository too.
I've tried to set distributionUrl to local nexus url and it works - distribution is installed and daemon is started.
But next it fails to load https://dl.google.com/android/repository/addons_list-5.xml with timeout
Is there a way to redirect all gradle requests to nexus repositories?

To redirect all Gradle requests to your Nexus repository, you can add the following to your gradle.properties file:
systemProp.http.proxyHost=<hostname>
systemProp.http.proxyPort=<port>
systemProp.http.nonProxyHosts=localhost|127.0.0.1
Replace and with the hostname and port of your Nexus repository. This will tell Gradle to use your local Nexus repository for all dependencies, including the addons_list-5.xml file that you are currently having trouble loading.
It's also a good idea to make sure that your Nexus repository is properly configured and has all the necessary dependencies. You can check the logs of your Nexus repository to see if there are any errors or issues that might be preventing Gradle from accessing the dependencies it needs.

Related

Nexus OSS does not start

I'm trying to install nexus 3.38 on a debian 10 system. I use aodoptopenjdk-8... as Java runtime.
When I try running it as a systemd sevrice nexus does not start. There are no usable logs.
Whe I try running nexus directly with command nexus start-launchd (virtually the same as nexus start) I get the following out put
bin/nexus start-launchd
Starting nexus
Could not resolve mvn:org.apache.felix/org.apache.felix.framework/6.0.5
I look for this library/dependency and find it in {nexus-home}/system/org/apache/felix/org.apache.felix.framework/6.0.5/. But the filename looks crippled org.apache.felix.framework- that's it. No *.jar. The same can be seen with some other dependencies, like other felix stuff or karaf.
Other dependecies in {nexus-home}/system look fine.
If I change the name from org.apache.felix.framework- to org.apache.felix.framework-6.0.5.jar then it looks like this dependency loaded and next stop is karaf.
Do I have to fix all the names of the jar files? Why do I not find other complains about that, is it an error in front of my monitor?
I've seen the same problem with current release of apache karaf. The names of the jar files are crippled.
The content of the folder system of the unix package (*.tar.gz) of nexus 3.38.0-01 is damaged.
I've downloaded the windows package (*.zip) and replaced the system with this version.
Everything looks fine now.

Sonatype Nexus only starting in console mode

I installed Nexus 3.6.0-02 on Redhat 7.4.
I am able to get Nexus to start in console mode by running the command: ./nexus run
If I try and start nexus as a service per the following documentation, nothing happens.
https://help.sonatype.com/display/NXRM3/Run+as+a+Service
If I run the command ./nexus start, the application does not start and there is nothing written into any nexus logs indicating why it failed to start.
The install and sonatype-work directories are all owned by the user who I have configured Nexus to run as.
Any ideas as to where to look or troubleshoot to figure this problem out.
Thanks
In my case I am using nexus 3 . I resolved this by deleting lock file placed inside nexus3 folder of sonatype folder and restart it by nexus start command.
Make sure the "run_as_user" configured in $install_dir/bin/nexus.rc has permissions to write to the installation directory and the work directory. And make sure they have a login shell, that is required for the startup script to work.

How to solve 405 error on maven build to Nexus 3?

I have created proxy repos in Nexus 3 pointing to Nexus 2 hosted repositories. This is to snapshot and release repositories on Nexus 2. Now, on distributionManagement tag, I am using the proxy URLs and trying do a mvn clean deploy. I am getting the following error:
[INFO] Error deploying artifact: Failed to transfer file: http://nexus3url/repository/m2-snapshots/path/abc-1.1.4-SNAPSHOT.pom. Return code is: 405
Has anyone tried this?
As indicated in the comments, you can only deploy to Maven Hosted Repositories, not Proxies. This is by design.
I faced same issue when I try to deploy application into nexus 3 repository.
In my case the url is not proxy but path was wrong.
If you are trying to deploy snapshot version make sure url pointing to nexus snapshot repository location.
if it is release version url should point to release repository.
Your Nexus folder type should be host and try
mvn deploy
command by using pipeline.
configFileProvider([configFile(fileId: '1880060f-32be-4888-a77d-eb046cab6981', variable: 'MAVEN_SETTINGS')]) {
sh "/jenkins_new/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.5.0/bin/mvn -s $MAVEN_SETTINGS deploy:deploy-file -DgroupId=net.cyc -DartifactId=${pom.artifactId} -Dversion=${pom.version} -DgeneratePom=true -Dpackaging=jar -DrepositoryId=nbtnexus -Durl=https://dexus.connectcare.net/repository/maven-snapshots/ -DpomFile=pom.xml -Dfile=target/${pom.artifactId}-${pom.version}.${pom.packaging}"
}

profile-refresh in Fuse 6.2 does not reload snapshot bundle

I am running JBoss Fuse 6.2.0.
I built a small camel application that just writes to the log every 5 seconds.
I built it and installed the SNAPSHOT bundle jar in my local Maven repository.
In the Karaf console I did the following:
fabric:profile-create --parent feature-camel logdemo
fabric:profile-edit --bundle mvn:com.company.project/logdemo logdemo
fabric:container-create-child --profile logdemo root child1
The camel application now worked as intended.
I then made a small change to the application, rebuilt it and installed the new SNAPSHOT bundle jar in my local Maven repo.
In the Karaf console I then did the following to get Karaf to load the new jar:
fabric:profile-refresh logdemo
But the loaded application is still the old version.
How do I get Karaf to look for the updated jar in my local maven repo? It seems like it has some internal cache it looks in instead.
Note: We're not using Maven to build the application, so all answers about using Maven plugins like the fabric8 plugin will be rejected.
You should use the fabric:watch * command for that. This will update all containers that run a snapshot version of an artifact that is updated in the local maven repo. If you want only a specific container to watch for updates use dev:watch * on the shell of that container.
See http://fabric8.io/gitbook/developer.html

Changing the nexus repository directory

when i install Nexus war into my tomcat server Nexus creating its folder etc at Win home directory. I want to redirect this to my different directory.
Meaning.. I want nexus to store its repository in user defined folder
How to do this ?
You should set the environment variable PLEXUS_NEXUS_WORK to your user defined folder in your the /bin/setenv.cmd file and restart Tomcat before deploying the Nexus web application.
I don't have a Windows example handy but here is the /usr/share/tomcat7/bin/setenv.sh on my Linux deployment:
#! /bin/sh
export PLEXUS_NEXUS_WORK=/var/nexus
I assume that the Windows equivalent might be:
SET PLEXUS_NEXUS_WORK=C:\NEXUS
Setting the PLEXUS_NEXUS_WORK environment variable didn't work for me using Tomcat 7 and Nexus 2.8. Perhaps this no longer works with newer versions of Nexus.
What did work was to change the nexus-work setting in nexus.properties file, which is in the WEB-INF/classes folder of the Nexus web app
Here is what my setting now looks like:
nexus-work=D:/sonatype-work/nexus
I would suggest to use the Nexus bundle installer with the embedded jetty server instead of running the Jetty war in Tomcat. While you can do that, you will not be able to upgrade to Nexus Professional easily since it is only supported with the embedded Jetty.
If you use the bundle installer the storage will be in a sibling folder to the nexus folder called sonatype-work/nexus.
Check out the free book Repository Management with Nexus for more info.
Since Nexus 2.8, you could set the nexus-work as an environment parameter for the tomcat JVM, like this :
JAVA_OPTS="-d64 -server -Xms128M -Xmx1024M -XX:MaxPermSize=512M -Dcom.sun.security.enableCRLDP=true -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=/tmp -Dnexus-work=/var/lib/nexus/work "
It works for me as I have the Nexus OSS as a war file into a RHEL6 tomcat6 installation.

Resources