Do we have to install/deploy parent maven module to use submodule? - maven-2

lets say we have a ParentPom.xml and there are sub child modules under it; subModule-A and subModule-B. I want to use subModule-A.jar in an another project. If i run "mvn install" command only in subModule-A directory i can install it into my M2 repository but after i define dependency to it from my other project it says something "no parent found for subModule-A". It is OK if i run install command for ParentPom.xml.
Any idea about this problem?
Thx...

You need to install / deploy all modules that are referenced by submodule-A, including the parent.
You can do it like this:
mvn deploy -pl submodule-a -am
Which translates to
deploy module submodule (-pl submodule-a)
and all of it's dependencies in the current reactor project (-am)
Call mvn -help to see all possible command line options

Related

Automatically downloading npm packages listed in package.json file

I'm working on creating a local repository that will contain all packages I use in my project, so I can have those packages installed on a machine that does not have access to the internet. I think of the repository that I could clone on the machine and run yarn install to have all the packages available in the project from the local repository. How can I do that? Similar question was asked here Using npm how can I download a package as a zip with all of its dependencies included in the package
There's not enough information in your question to fully understand your situation, but if you commit your node_modules directory to the repository, the modules will be there without the user having to run npm or yarn to install them. This assumes the user will run code from the repo workspace and that there aren't any modules that require a compilation step or other build step that may be platform-specific. But if they're all plain ol' JavaScript modules, you should be fine.
If you want to have all the modules as a separate repo rather than checking in node_modules, I can offhand think of two ways this might work.
Have the packages repo be a check-in of a fully installed node_modules directory. Then make that repo a Git submodule of the main repo that gets cloned as node_modules in the main repo.
Use npm pack to create .tgz files for each package you need. Store those files in the packages repo. Clone that repo into a known path on your target machine. Have the main repo install via path names. For example, if you run npm install /var/packages/foo-1.0.0.tgz, it will add a line to your package.json that might look something like this: "foo": "file:../../../var/packages/foo-1.0.0.tgz". In that case, npm install will install from that path rather than over the network.

Serverless framework running Java code hangs

I'm running Serverless 2.15.0 with Node 14.15.0. I've tried installing both with npm i -g and by using the curl script in the tutorial. I have Maven 3.6.3 installed
When I try to run a simple Java "hello world" function locally, I get this message:
Serverless: Building Java bridge, first invocation might take a bit longer.
Then Serverless just hangs. No error message, nothing. When I try to run with SLS_DEBUG=*, there are no messages after that point.
The only thing I've been able to Google is this, but there isn't any resolution to the problem. The other thing I've found is this but there seems to be no java directory where Serverless is installed, so I can't manually compile the pom file.
Anyone know how to fix this problem?
The problem is that they moved the path of the java runtime wrapper. Base paths differ regarding install location.
NVM (global installation)
cd ~/.nvm/versions/node/v16.13.1/lib/node_modules/serverless/lib/plugins/aws/invoke-local/runtime-wrappers/java
mvn package
NPM (global installation)
cd ~/.npm-global/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/runtimeWrappers/java
mvn package
Homebrew
cd /usr/local/Cellar/serverless/2.29.0/libexec/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/runtimeWrappers/java
mvn package
Replace 2.29.0 with installed serverless version.

Bundle local NPM dependencies and publish

I have a project comprised of:
module1/
module2/ (depends on module1)
mainmodule/ (depends on module2)
Is is possible to publish mainmodule without publishing module1 and module2?
I.e. to somehow bundle the local dependencies inside of mainmodule?
Are you importing the dependency module using import or require? If yes, yes you can create a unique bundle from your mainmodule using a bundler like webpack.
Inside your mainmodule, you just need a package.json file and Webpack installed locally or globally. After that just run this command
webpack mainmodule.js -o bundle.js
and Webpack will bundle all the modules together is just one module.

How can I build mapbox-gl.js with Browserify?

If I git clone the repo (from mapbox-gl.js repo), how can I build my own standalone version of the files?
I just need the standalone mapbox-gl.js, like this one.
A simple browserify js/mapbox-gl.js -o dist/mapbox-gl.js does not work.
I just added a section to the mapbox-gl-js readme on this topic.
Creating a Standalone Build
A standalone build allows you to turn the contents of this repository
into mapbox-gl.js and mapbox-gl.css files that can be included on
an html page.
To create a standalone build, run bash npm run production
Once that command finishes, you will have a standalone build at
dist/mapbox-gl.js and dist/mapbox-gl.css
I hope that helps! Let me know if you have any follow-up questions.
To create standalone files, run npm run build in root of repo.

Maven download source codes command line using POM.xml

I want to download the source codes of json-simple library using maven2 command line interaface. So, I download this .pom file into ~/project/pom.xml
http://json-simple.googlecode.com/svn/trunk/pom.xml
And then, using the relevant SO question's answer: How to install Maven artifact with sources from command line?, I try to download source codes with the following commands,
$ cd ~/project
$ mvn eclipse:eclipse -DdownloadSources=true
$ ls
The output is only the pom.xml. What is wrong?
$ mvn --version
Apache Maven 2.2.1 (rdebian-8)
Use the get goal of the dependency plugin
Full command line (execute somewhere - you do not need a pom)
mvn -DgroupId=com.googlecode.json-simple
-DartifactId=json-simple
-Dversion=1.1.1
-Dclassifier=sources
-DremoteRepositories=http://nexus.dmz1.heuboe.hbintern:8080/nexus/content/repositories/central/
org.apache.maven.plugins:maven-dependency-plugin:2.8:get
or as a oneliner
mvn -DgroupId=com.googlecode.json-simple -DartifactId=json-simple -Dversion=1.1.1 -Dclassifier=sources -DremoteRepositories=http://nexus.dmz1.heuboe.hbintern:8080/nexus/content/repositories/central/ org.apache.maven.plugins:maven-dependency-plugin:2.8:get
Normally I am using Maven 3 but I tested this also with Maven 2.2.1 on Windows and it works.
You can also consider to use the m2e Maven Integration in eclipse (check the eclipse Marketplace to install this if not already installed) instead of the maven-eclipse-plugin (eclipse:eclipse). You than have an eclipse preferences option to download the sources.