I wanted to update propel generated classes that are present in the model folder as I have modified my database schema (i.e., I have added one column in a table). What are the steps to update the model classes?
Please follow below steps to update propel model classes:
Remove all the files inside the /vendor folder of your application
execute the below command from the folder where composer.json exists
$ composer update
set the path variable to /path/to/vendor/bin folder
Run the propel reverse task to generate schema.xml specifying your database credentials
$ propel reverse "mysql:host=localhost;dbname=db;user=root;password=pwd"
Output of above command will be schema.xml file
Replace your schema.xml file in the project with this new one
From the command prompt go to the folder where you copied schema.xml file and execute below commands.
$ propel sql:build
$ propel model:build
Thats it. Propel model classes should get updated.
Related
I know that liquibase will create a databasechangelog to check if one change set has been applied. But if i let the app to run it automatically, the FILENAME column will store the relative path of the changelog file. But if I run mvn liquibase:status, it said my change set had not been applied, the cause is that in liquibase.properties file I defined the path of the changelog as absolute path (i.e changeLogFile=src/main/resources/db/changelog/db-changeLog-master.xml) while for spring boot app automatic migration the path was defined as relative path (spring.liquibase.change-log=classpath:db/changelog/db-changeLog-master.xml) in application.properties file and "db/changelog/db-changeLog-master.xml" was stored in the database. If you do it manually (by running mvn liquibase:update), "src/main/resources/db/changelog/db-changeLog-master.xml" would be stored instead.
How could I solve this problem? Since I wanna have control over the migration (i.e. do the migration manually) or check the status of migration in development environment.
after I changed the property: changeLogFile=/db/changelog/db-changeLog-master.xml, in liquibase.properties, mvn command works as expected: now liquibase consider the path of my changelog to be "db/changelog/db-changeLog-master.xml"
I am using artifactory and have no issues with the npm solution. However, I have set up composer using the "Set Me Up" instructions, i.e. installed the ~/.composer/config.json & ~/.composer/auth.json files. I now get the following error when I try to perform a composer install:
$ dcomp install
Loading composer repositories with package information
[Composer\Downloader\TransportException]
The "https://myartifactory.jfrog.io/artifactory/api/composer/php-local/packages.json" file could not be downloaded (HTTP/1.1 404 Not Found)
install [--prefer-source] [--prefer-dist] ...
The user I have configured in auth.json is an admin user, and I've pushed a single package into the Artifactory. Additionally, I noticed the url contains plural packages.json as opposed to singular package.json, so I am assuming this is an issue with the artifactory configuration itself and not the package I've uploaded.
For Artifactory to index composer packages successfully you also need to make sure that each package has version specified.
There are 3 ways to achieve that:
Include the version attribute in the package composer.json file
Set a composer.version property on the package itself.
Use the version field when deploying it via the UI.
You can easily test it inside the UI by clicking on the archive you just uploaded, then go to the properties tab and add a property for example:
composer.version with value for example 1.0.0.
The issue in my case was as a couple commenters observed: the index wasn't being generated.
For me, the fix was a matter of using a .zip compressed file to upload composer packages instead of a .tar.gz. I can't tell you why a tarball won't work, especially considering Artifactory's documentation explicitly mentions tar.gz, but it would appear .zip is the way to go.
When you first create a PHP composer repository in Artifactory it will not have the repository index yet (package.json file). The index will be created only after you deploy your first package.
It is possible that Artifactory was unable to read the package metadata for the package you deployed. In such a case, assuming this is the only package in the repository, the index will not be calculated.
In order to verify this is the case:
Browse the php-local repository in the Artifactory UI
Check for the presence of a .composer/packages.json file (relative to the repository root). If it does not exist, it is an indication that Artifactory was unable to calculate the repository index
Select the package you deployed, and switch to the Composer Info tab
Check that you can see the correct package version. If you see "No version found" - there was an issue with getting the version (probably because it is not included in the composer.json file)
Look for an error similar to the following in the artifactory log file:
Failed to persist package metadata for 'php-local/my-package.zip'.
Unable to read the package version from the extracted composer.json
file
If this is the case, you can solve the issue by:
Add a property named composer.version to your composer package and set its value to be the correct package version. You can do it by selecting the package file from the UI, switching to the Properties tab and adding a new property
If this done correctly you should be able to see the correct version in the Composer Info tab and that the packages.json file is being generated
If all of this does not help and the packages.json file is still not generated, there is probably another error which prevents Artifactory from generating it.
Try re-generating the repository index by:
Going to the root of the repository in the Artifactory UI
Right click the root of the repository and choose "Recalculate Index"
The index should be generated in the background
If the index is still not generated search the artifactory log file for any relevant error messages
Finally, one more option to try is deploying a different composer package and seeing if it behaves the same.
I have seen an Include / Exclude Pattern on the Jfrog repository that does not match the <vendor>/<package> naming standard cause this issue. We were able to upload artifacts but they were excluded metadata endpoint.
The following endpoint returned a 404 response code for every package until the Include / Exclude Pattern was fixed.
https://<org>.jfrog.io/artifactory/api/composer/<repo>/p2/<vendor>/<package>.json
I am new to Docker. I am using spring boot and when we build the project using maven, it will create jar file like app-.jar and then I am coping this jar file using ADD command in DockerFile. Now If I change the version number in pom.xml, then I need to manually update the JAR file name in DockerFile.
Is there anyway by which I can dynamically get the version number which is in the pom.xml and update the JAR file name automatically in the DockerFile?
Instead of copying the jar file inside the dockerfile, you can mount the folder in which jar is created. And you will not be needed to be worried with the filename.
What you want can be done using environment variables. You can create an --env-file and keep your version number there. And inside dockerfile, refer to value of variable declared in env file with {VERSIION}. By following this process, you may want to use this same version in your pom file. For that, take a look at this question.
The answer links environment variables by setting env.path and detailed guide is here.
I'm trying to run the analysis locally using Sonar-Scanner 2.6 pointing to SonarQube 5.4. The local solution folder contains the sonar-project.properties file used in the cloud analysis.
I am trying to create the properties file to be used locally, that is separate from the global sonar-project.properties file. This is the command that I ran:
sonar-scanner -D project.settings=sonar-project-local.properties
Expected behavior: Of the two files (sonar-project.properties and sonar-project-local.properties), sonar-scanner would choose the local one.
Observed behavior: If the file sonar-project.properties exists, sonar-scanner uses the global one and ignores the local one.
If I remove (rename) the global file from the directory, then the local file is recognized, and behavior is as expected.
Is this a bug? What is the way to solve this issue without messing with the global properties file?
Generally the answer would be the space in your command. So, not
-D project.settings=...
but
-Dproject.settings=...
But that property was dropped. You'll just need to shuffle the properties files in/out of the "correct" name.
I'm a newbie in ruby on rails and creating a redmine plugin. I created a model Allissue without using any column. Now I wanted to add a column project_name with the help of migration ./script/generate migration AddRoleToAllissue project_name:string.
But it places migration in folder db/migrate named 20120722192815_add_role_to_allissue.rb instead of plugin migrate folder. I followed stack-overflow question and move migrated file to plugin folder mv ./db/migrate/20120722192815_add_role_to_allissue.rb ./vendor/plugins/redmine_allissues/db/migrate/002_add_role_to_allissue.rb.
I just wanted to know alternative for plugin migration in which no need of moving migrated file to plugin folder. I'm not sure but there may be a command for plugin migration. Thanks
In fact, you are generating a Rails migration and not a Redmine plugin migration. This is why your migration file is in db/migrate folder.
The right syntax is for Rails 3.x (Redmine >= 2.x):
rails generate redmine_plugin_model <plugin_name> <model_name> ...
for Rails 2.x (Redmine <2.x):
script/generate redmine_plugin_model <plugin_name> <model_name> ...
It will generate the migration in the right place.
You should check the tutorials on the Redmine wiki about plugins.