SBT Assembly remove classes from another JAR - scala

This is the package structure of my repo:
src
|-- main
|-- scala
|-- me.sparker0i.spark
|-- runner
|-- Runner.scala
|-- utils
|-- Constants.scala
|-- DatabaseUtils.scala
|-- service
|-- Service.scala
|-- Transform.scala [extends Service]
|-- Fetch.scala [extends Service]
|-- <32 more>
|-- Test.scala
I want to split this application into two such that one application remains the core, while the other uses the core jar as a libraryDependencies:
Core Repo structure:
src
|-- main
|-- scala
|-- me.sparker0i.spark
|-- runner
|-- Runner.scala
|-- utils
|-- Constants.scala
|-- DatabaseUtils.scala
|-- service
|-- Service.scala
|-- Test.scala
Independent Repo:
src
|-- main
|-- scala
|-- me.sparker0i.spark
|-- service
|-- Transform.scala [extends Service from Core Repo JAR]
|-- Fetch.scala [extends Service from Core Repo JAR]
|-- <32 more>
Now inside the Independent Repo, I've referenced the Core Repo JAR inside libraryDependencies. I need that Core JAR to run the test cases of the Independent Repo inside our Jenkins CICD, but not when I need to package the Independent Repo.
When I do sbt assembly, how do I ensure that I don't get the contents of the Core JAR inside the Independent JAR? The reason being I will be running the Main class inside the Core JAR, but will also be supplying the Independent JAR as a class path.
Is there some way the above requirement can be achieved using sbt?

You could declare the dependency with scope Provided. This is exactly meant for this use case, i.e. a dependency is provided somehow at runtime but not part of the package.
groupId % core % version % Provided

Related

Timed out while searching for 'workspaceContains' VSCODE

Extensions sometime not activated, in Log (Extension Hosts) appear this message
[2022-01-07 08:25:00.723] [exthost] [info] Not activating extension 'apollographql.vscode-apollo': Timed out while searching for 'workspaceContains' pattern **/apollo.config.[jt]s,**/apollo.config.cjs
and its happen with some extensions too. I checked config file is already in correct folder
What's I Tried so Far
Reload Window
Reinstall Extensions
Install Another Version (Ext)
Completely delete Ext files in %USERPROFILE%\.vscode\extensions
Activation Events apollographql.vscode-apollo
workspaceContains:**/apollo.config.[jt]s
workspaceContains:**/apollo.config.cjs
Workspace Tree
|-- Workspace
|-- Some Project
|-- Vue Project
|-- apollo.config.js
|-- Some Project
Reply in comment, if you need spesific settings.
Thanks in Advance.

Import and use protobufs outside of lib directory - dart

I am trying to build a web application with with Flutter for the frontend, go for the backend and gRPC as the communication protocol. In an effort to avoid using identical protobufs in 2 different directories, I refactored the protobufs and compiled them into a third directory outside of the client and server folders (all within the same repo). Now I'm having trouble accessing the compiled dart protobufs from the client code. Here is my folder structure:
.
|-- client/
|-- pubspec.yaml
|-- protos/
|-- dart_protos/
|-- .dart_tool/
|-- .packages
|-- cards.pb.dart
|-- cards.pbenum.dart
|-- cards.pbjson.dart
|-- cards.pbserver.dart
|-- pubspec.lock
|-- pubscpec.yaml
|-- go_protos/
|-- cards.proto
|-- server/
Here is how I am defining my dependencies in my client/pubspec.yaml
dependencies:
flutter:
sdk: flutter
recase: ^4.0.0
search_choices: ^2.0.7
tcb_protos:
path: ../protos/dart_protos
My protos/dart_protos/pubspec.yaml:
name: tcb_protos
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
protobuf: ^1.1.4
protoc_plugin: ^19.3.1
And how I am importing the protobuf:
import 'package:tcb_protos/cards.pb.dart';
So I am running into a couple of issues:
I am getting Target of URI hasn't been generated: 'package:tcb_protos/cards.pb.dart'. on the import
I am unable to use the protobuf based on the import, and VSCode's intellisense isn't working on the package (which I am assuming is because either the package definition or import is wrong)
How can I use the protobuf in my Flutter widgets?
You need to have the proto .pb.dart files inside a lib/ folder.
I made a small example here: https://github.com/sigurdm/shared_proto_example
If you want to have protos in different packages that reference each other, that is currently not supported: https://github.com/google/protobuf.dart/issues/295

How do I re-root a eclipse project to a parent folder without break it?

I did a project with eclipse and I shared it on github. After much work, I realized that the whole project is in a folder called 'projectname'.
A graphic explains it better.
|-- README.md
`-- projectname
|-- model
|-- public
| |-- images
| |-- css
| `-- index.html
|-- package.json
`-- app.js
But I need it in the base directory.
|-- README.md
|-- model
|-- public
| |-- images
| |-- css
| `-- index.html
|-- package.json
`-- app.js
So how do I move these files without breaking the repository or break the eclipse project?
Delete the project from inside of Eclipse, making sure to NOT remove the underlying files, fix the git repository, and then re-import the project from the Git Repositories view into the workspace.

Print Directory & File Structure with icons for representation in Markdown [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
This post was edited and submitted for review 4 months ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I want a Linux command to print directory & file structures in the form of a tree, possibly with Unicode icons before each file, and some hint for the best syntax to include the output in a Markdown document, without spaces between lines.
Example:
.
├── _config.yml
├── _drafts
│ ├── begin-with-the-crazy-ideas. Textile
│ └── on-simplicity-in-technology. Markdown
├── _includes
│ ├── footer.html
│ └── header.html
├── _layouts
│ ├── default.html
│ └── post.html
├── _posts
│ ├── 2007-10-29-why-every-programmer-should-play-nethack.textile
│ └── 2009-04-26-barcamp-boston-4-roundup.textile
├── _data
│ └── members.yml
├── _site
└── index.html
I followed an example in another repository and wrapped the directory structure within a pair of triple backticks (```):
```
project
│ README.md
│ file001.txt
│
└───folder1
│ │ file011.txt
│ │ file012.txt
│ │
│ └───subfolder1
│ │ file111.txt
│ │ file112.txt
│ │ ...
│
└───folder2
│ file021.txt
│ file022.txt
```
If you are concerned about Unicode characters you can use ASCII to build the structures, so your example structure becomes
.
+-- _config.yml
+-- _drafts
| +-- begin-with-the-crazy-ideas.textile
| +-- on-simplicity-in-technology.markdown
+-- _includes
| +-- footer.html
| +-- header.html
+-- _layouts
| +-- default.html
| +-- post.html
+-- _posts
| +-- 2007-10-29-why-every-programmer-should-play-nethack.textile
| +-- 2009-04-26-barcamp-boston-4-roundup.textile
+-- _data
| +-- members.yml
+-- _site
+-- index.html
Which is similar to the format tree uses if you select ANSI output.
If you're using VS Code, this is an awesome extension for generating file trees.
Added directly to markdown...
📦quakehunter
┣ 📂client
┣ 📂node_modules
┣ 📂server
┃ ┗ 📜index.js
┣ 📜.gitignore
┣ 📜package-lock.json
┗ 📜package.json
You can use tree to generate something very similar to your example. Once you have the output, you can wrap it in a <pre> tag to preserve the plain text formatting.
As already recommended, you can use tree. But for using it together with restructured text some additional parameters were required.
The standard tree output will not be printed if your're using pandoc to produce pdf.
tree --dirsfirst --charset=ascii /path/to/directory will produce a nice ASCII tree that can be integrated into your document like this:
.. code::
.
|-- ContentStore
| |-- de-DE
| | |-- art.mshc
| | |-- artnoloc.mshc
| | |-- clientserver.mshc
| | |-- noarm.mshc
| | |-- resources.mshc
| | `-- windowsclient.mshc
| `-- en-US
| |-- art.mshc
| |-- artnoloc.mshc
| |-- clientserver.mshc
| |-- noarm.mshc
| |-- resources.mshc
| `-- windowsclient.mshc
`-- IndexStore
|-- de-DE
| |-- art.mshi
| |-- artnoloc.mshi
| |-- clientserver.mshi
| |-- noarm.mshi
| |-- resources.mshi
| `-- windowsclient.mshi
`-- en-US
|-- art.mshi
|-- artnoloc.mshi
|-- clientserver.mshi
|-- noarm.mshi
|-- resources.mshi
`-- windowsclient.mshi
I made a node module to automate this task: mddir
Usage
node mddir "../relative/path/"
To install: npm install mddir -g
To generate markdown for current directory: mddir
To generate for any absolute path: mddir /absolute/path
To generate for a relative path: mddir ~/Documents/whatever.
The md file gets generated in your working directory.
Currently ignores node_modules, and .git folders.
Troubleshooting
If you receive the error 'node\r: No such file or directory', the issue is that your operating system uses different line endings and mddir can't parse them without you explicitly setting the line ending style to Unix. This usually affects Windows, but also some versions of Linux. Setting line endings to Unix style has to be performed within the mddir npm global bin folder.
Line endings fix
Get npm bin folder path with:
npm config get prefix
Cd into that folder
brew install dos2unix
dos2unix lib/node_modules/mddir/src/mddir.js
This converts line endings to Unix instead of Dos
Then run as normal with: node mddir "../relative/path/".
Example generated markdown file structure 'directoryList.md'
|-- .bowerrc
|-- .jshintrc
|-- .jshintrc2
|-- Gruntfile.js
|-- README.md
|-- bower.json
|-- karma.conf.js
|-- package.json
|-- app
|-- app.js
|-- db.js
|-- directoryList.md
|-- index.html
|-- mddir.js
|-- routing.js
|-- server.js
|-- _api
|-- api.groups.js
|-- api.posts.js
|-- api.users.js
|-- api.widgets.js
|-- _components
|-- directives
|-- directives.module.js
|-- vendor
|-- directive.draganddrop.js
|-- helpers
|-- helpers.module.js
|-- proprietary
|-- factory.actionDispatcher.js
|-- services
|-- services.cardTemplates.js
|-- services.cards.js
|-- services.groups.js
|-- services.posts.js
|-- services.users.js
|-- services.widgets.js
|-- _mocks
|-- mocks.groups.js
|-- mocks.posts.js
|-- mocks.users.js
|-- mocks.widgets.js
If you're using Atom editor, you can accomplish this by the ascii-tree package.
You can write the following tree:
root
+-- dir1
+--file1
+-- dir2
+-- file2
and convert it to the following by selecting it and pressing ctrl-alt-t:
root
├── dir1
│ └── file1
└── dir2
└── file2
I scripted this for my Dropbox file list.
sed is used for removing full paths of symlinked file/folder path coming after ->
Unfortunately, tabs are lost. Using zsh I am able to preserve tabs.
!/usr/bin/env bash
#!/usr/bin/env zsh
F1='index-2.md' #With hyperlinks
F2='index.md'
if [ -e $F1 ];then
rm $F1
fi
if [ -e $F2 ];then
rm $F2
fi
DATA=`tree --dirsfirst -t -Rl --noreport | \
sed 's/->.*$//g'` # Remove symlink adress and ->
echo -e '```\n' ${DATA} '\n```' > $F1 # Markdown needs triple back ticks for <pre>
# With the power of piping, creating HTML tree than pipe it
# to html2markdown program, creates cool markdown file with hyperlinks.
DATA=`tree --dirsfirst -t -Rl --noreport -H http://guneysu.pancakeapps.com`
echo $DATA | \
sed 's/\r\r/\n/g' | \
html2markdown | \
sed '/^\s*$/d' | \
sed 's/\# Directory Tree//g' | \
> $F2
The outputs like this:
```
.
├── 2013
│   └── index.markdown
├── 2014
│   └── index.markdown
├── 2015
│   └── index.markdown
├── _posts
│   └── 2014-12-27-2014-yili-degerlendirmesi.markdown
├── _stash
└── update.sh
```
[BASE_URL/](BASE_URL/)
├── [2013](BASE_URL/2013/)
│   └── [index.markdown](BASE_URL/2013/index.markdown)
├── [2014](BASE_URL/2014/)
│   └── [index.markdown](BASE_URL/2014/index.markdown)
├── [2015](BASE_URL/2015/)
│   └── [index.markdown](BASE_URL/2015/index.markdown)
├── [_posts](BASE_URL/_posts/)
│   └── [2014-12-27-2014-yili-degerlendirmesi.markdown](_posts/2014-12-27-2014-yili-degerlendirmesi.markdown)
├── [_stash](BASE_URL/_stash/)
├── [index-2.md](BASE_URL/index-2.md)
└── [update.sh](BASE_URL/update.sh)
* * *
tree v1.6.0 © 1996 - 2011 by Steve Baker and Thomas Moore
HTML output hacked and copyleft © 1998 by Francesc Rocher
Charsets / OS/2 support © 2001 by Kyosuke Tokoro
I'd suggest using wasabi then you can either use the markdown-ish feel like this
root/ # entry comments can be inline after a '#'
# or on their own line, also after a '#'
readme.md # a child of, 'root/', it's indented
# under its parent.
usage.md # indented syntax is nice for small projects
# and short comments.
src/ # directories MUST be identified with a '/'
fileOne.txt # files don't need any notation
fileTwo* # '*' can identify executables
fileThree# # '#' can identify symlinks
and throw that exact syntax at the js library for this
Under OSX, using reveal.js, I have got rendering issue if I just user tree and then copy/paste the output: strange symbols appear.
I have found 2 possible solutions.
1) Use charset ascii and simply copy/paste the output in the markdown file
tree -L 1 --charset=ascii
2) Use directly HTML and unicode in the markdown file
<pre>
.
⊢ README.md
⊢ docs
⊢ e2e
⊢ karma.conf.js
⊢ node_modules
⊢ package.json
⊢ protractor.conf.js
⊢ src
⊢ tsconfig.json
⌙ tslint.json
</pre>
Hope it helps.
If you wish to generate it dynamically I recommend using Frontend-md. It is simple to use.
There is an NPM module for this:
npm dree
It allows you to have a representation of a directory tree as a string or an object. Using it with the command line will allow you to save the representation in a txt file.
Example:
$ npm dree parse myDirectory --dest ./generated --name tree

my application stopped working with xulrunner 10.0.4

When I upgraded to centos 6 and xulrunner 10.0.4, my app stopped working. Xulrunner just hangs.
My directory structure:
.
|-- application.ini
|-- chrome
| |-- chrome.manifest
| `-- content
| |-- main.xul
| `-- main.xul.tpl.org
|-- defaults
| `-- preferences
| `-- prefs.js
According to example application from developer.mozilla.org, your application is missing the chrome.manifest as a sibling file of application.ini with the content:
manifest chrome/chrome.manifest
The funny thing is it works on xulrunner 12.0 but not on 10.0. Just add the file and your application should work.