Changing the nexus repository directory - nexus

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.

Related

Is it possible to make gradlew to work with 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.

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.

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

compilation problems after setting classpath in tomcat 5.5

I have installed Tomcat 5.5 in windows vista home basic. I have set classpath to
"C:\program files\apache software foundation\tomcat 5.5\common\lib\servlet-api.jar".
now there are two problems.
1. I could not compile my servlets. It says package javax.servlet.* dosenot exist.
2. I could not connect with local host in chrome nor in explorer.
these errors are appearing inspite of server instance running.
Classpath to java sdk and tomcat are different. is it the matter of concern.
Please help.
I have invested considerable amount of time figuring out the problem.
thanx in advance.
I could not compile my servlets. It says package javax.servlet.* dosenot exist.
It means that the classpath for javac is not been correctly specified. It should go like so:
javac -cp .;"/path with spaces/to/servlet-api.jar" com/example/YourServlet.class
Note that you need to surround a path with spaces by doublequotes.
I could not connect with local host in chrome nor in explorer. These errors are appearing inspite of server instance running.
Then you used the wrong domain/port. When running Tomcat at the local machine, the domain should at least be localhost. The actual port can be determined in Tomcat/conf/server.xml file. It defaults to 8080, but can be changed during the Windows setup wizard. The final URL should look like http://localhost:8080. If you use port 80 which is the default HTTP port, then the :80 part can be omitted from the URL.
Classpath to java sdk and tomcat are different.
The %CLASSPATH% environment variable is worthless. Use -cp argument. If you want to avoid long typing/remembering everytime, consider using a .bat file with the command, or a build tool like Ant, or an IDE like Eclipse.
The %JAVA_HOME% environment variable is however important. Tomcat needs to know it in order to have access to the toolset to compile JSP files. The %JAVA_HOME% should point to the installation directory of the JDK.
I have set classpath to "C:\program
files\apache software
foundation\tomcat
5.5\common\lib\servlet-api.jar"
If this means CLASSPATH environment variable, you're learning a valuable lesson: it's worthless. javac.exe and java.exe ignore it; so do all Java EE app servers like Tomcat; so do all IDEs like IntelliJ.
You'll have to add servlet-api.jar to your CLASSPATH using javac.exe -cp every time you compile in a command shell, or add it to your IDE project CLASSPATH, or set it up in Ant.
If you can't connect to localhost using Chrome or Explorer, it probably means that you haven't packaged or deployed your app properly. Make sure you create a valid WAR file and put it in the Tomcat 5.x /webapps directory to deploy.

Resources