I have a project and a subproject there are apis in sub project which are accessed via main project.
First I compile the subproject into jar along with dependencies.
Next I load the jar using url classloaders
Next from main project using reflection I consume the apis in subproject.
I have configured flyway in the sub project and added the sql scripts in subproject. Flyway migration is done using an api call. Now when I hit the api directly in sub project, flyway scripts are executed. If I load the class via classloaders and then hit the api from main project the scripts are not executed.
Related
I have my ASP.NET Core + Angular WebApp uploaded to GitHub(through VSTS) and now I would like to set up the CI pipeline. After that I would like to deploy my app to Azure.
In the template section - there is an ASP.NET Core template, but also an Azure Web App template.
Considering my case which is better suited for this case?
I found the almost perfect working answer in Levi Fuller's blog.
You can get it working with a minor change: unlike what Levi states, you really need only a single npm task
set up the npm task
by clicking the three dots button -> set the Working folder with package.json to your folder that contains the package.json file.
set up the Azure App Service Deploy
by clicking the three dots button -> set the Package or folder to your folder that contains the .csproj file.
There isn’t the build template that you use directly, the template is convenient to use, you need to modify it per to detail requirement.
Refer to these steps:
Go to build page of team project (e.g. https://XXX.visualstudio.com/[teamproject]/_build)
Click +New button to create a build definition with ASP.NET Core template
Add npm install task before .NET Core Restore task (Command: install; Working folder with package.json:[package.json folder path])
(optional) Delete/disable .NET Core Test task if you don’t need
Add Azure App Service Deploy task at the end (Package or folder: $(build.artifactstagingdirectory)/**/*.zip; Check Publish using Web Deploy option)
Note: you can move step 4 to release and link this build to release (change package or folder to $(System.DefaultWorkingDirectory)/**/*.zip).
I have prepared a web deployment package from my staging environment as a FileSystem. However, there is not a folder with necessary classes. My logic of hitcounter is situated there. I have tried to just copy this folder with classes to a web deployment folder, but I've caught an error when I try to run my website at a hosting provider. If I run locally my web application it works okay.
Is there a special way to include this folder to a web deployment package?
I run on a restricted shared hosting (godaddy).
if your hitcounter class is inside your project namespace it will be compiled inside your project dll. so if your namespace is like myproject.helpers.hitcounter, then it will be in the myproject.dll
there is no need to add the classes to your hosting service.
How can I enable migrations in a testing project?
PM> Enable-Migrations
Could not load assembly 'CreditoImobiliarioBB.EntityFramework.Test'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)
Have you verified that your Startup Project (in Solution Explorer) and your Default Project (in Package Manager Console) are set correctly?
The Startup Project setting should be familiar to you if you've developed any web applications before. e.g. if you have an ASP.NET MVC web project, this should be selected as the startup project (shown in bold) in the Solution Explorer.
As you probably know, this ensures that running the application will load this web project in the browser. In addition to that, you should also know that this is where Migrations will try to locate the web.config file with the proper DB connection string.
The Default Project setting (different from the aforementioned Startup Project) setting is set in a dropdown within the Package Manager Console, where you run commands such as Enable-Migrations, Add-Migration and Update-Database.
I would recommend enabling your migrations in a data layer project. But if you want to use your Test project, make sure you select the name of the Test project in the Default Project dropdown of your Package Manager Console.
Hope this helps!
I am new to deployment and development of web applications.
Suppose I create three jar files and deploy them on a Tomcat server. I use maven to install the jar file and to deploy.
How is it possible to call a method in another jar file?
For example:
I developed a simple application in mytwitter.jar.
Then, I create myapp.jar, where one of the classes needs to call a method in mytwitter.jar.
Do I first deploy mytwitter.jar to the server and myapp.jar later?
You package all of the JARs you need (yours and 3rd party alike) into a WAR file which is what gets deployed to the Tomcat server. So in your maven config you likely already have dependencies configured for things like the twitter API and other packages. Just add your own JARs in there as well and then your code has access to it like anything else.
I have a multi module SBT project. It has three modules; core, connector and integration. Sub module integration depends on both core and connector.
I want to writing a custom task for project integration to package every thing for deployment. From that task I should be able to create jar files of all sub modules and put them in to a lib folder along with other project dependencies. I've managed to get all the library dependencies using
fullClasspath in Runtime
With that I'm also getting the compiled class folders of two depending projects(core, connector). But what I want is to include jar files created from core and connector.
I can run the package command separately in my sub modules and copy the jars from my custom task. But I think there should be a way to create the jar files of sub modules from my custom task directly. Currently I'm creating the jar file of integration sub module which this custom task is binded to using
packageBin in Compile
I think there should be a way to execute same command in other modules from my custom task. Is it possible to do this in SBT?