How to access one module service in another module service (Liferay 7) - liferay-7

Suppose, I have two service builder Modules (Let's namely call it "First" and "Second"). Now I want to use "First" service in "Second" ???
So in "Second" build.gradle (of both Second-service and Second-api) I added below entry
compileOnly project(":modules:First:First-api")
Also tried with:
compile project(":modules:First:First-api")
But it's showing Unable to find module error
Any Suggestion ?
~Regards
Chandan

Have you tried anything like adding the dependency in "Second" project build.gradle file.

Related

AppBundle symfony 4

I have a problem with Symfony 4, I want generate entities from an existing database with the command :
php bin/console doctrine:mapping:import --force AppBundle xml
But an error appears :
Bundle "AppBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your App\Kernel.php file?
I try to import in the file kernel.php in registerBundles() :
new AppBundle/AppBundle();
but undefined class and when I create it in src/AppBundle/AppBundle.php :
<?php
namespace AppBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AppBundle extends Bundle
{
}
nothing change and when I retry the command :
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "AppBundle" from namespace "App".
Did you forget a "use" statement for another namespace? in /var/www/html/symfony/Mission3/src/Kernel.php:30
I would like to know if it's possible to create a bundle like that or if it exists an other command to generate entities from an existing database.
in SF4, The main application component is named 'App' by default and is not a bundle.
You have to manually create a dummy bundle under src\ directory in order to use old doctrine:command related to bundle.
see how to manually create a bundle here
After that, you can import/generate mappings/entities using doctrine:commands and use them in the App main module space, or in those bundles.
The SF4 maker tool don't provide bundle creation yet ... But I suppose the SF4 developers consider it's not an urge must have requirement, because they want us to focus on putting most code in the bundle less App main module.
In symfony 4 'AppBundle' is doesn't exist anymore. Try use 'App' instead 'AppBundle'

Remoting in spring: es.interop.dto.NameDto cannot be cast to es.interop.dto.NameDto

I have a Multi-Project gradle + spring-boot configuration. There is a ":interop" project that contains common classes and there are other two projects, ":backend" and ":frontend" that include this other project as dependency, like this:
compile project(":interop")
I execute an RMI call from ":frontend" to ":backend". If I execute .gradlew build and run the resulting jars from command line I get no error. But if I run them directly in eclipse I get the following error in ":frontend":
java.lang.ClassCastException: es.interop.dto.NameDto cannot be cast to es.interop.dto.NameDto
There are only two copy of NameDto.class in file system.
$ find ~ -name NameDto.class
./interop/bin/es/interop/dto/NameDto.class
./interop/build/classes/main/es/interop/dto/NameDto.class
The .classpath includes the project as:
$ grep interop frontend/.classpath
<classpathentry kind="src" path="/interop"/>
Any glues are welcome.
edit The service definition is:
public interface NameService {
List<NameDto> findAll();
NameDto create(String value);
}
edit I am using Dev-Tools. It is causing the problems:
compile("org.springframework.boot:spring-boot-devtools:1.3.0.RELEASE")
I found that Dev-Tools reloads always on startup, even without changing the code once started. In this reload, probably, bytecode of NameDto is modified in backend and frontend so two different versions classes appear.
Removing Dev-Tools dependency worked for me.
Looking for a better answer in Dev-Tools docs it seems that using Dev-Tools in addition to a java-agent such as JRebel or SpringLoaded prevents reload on start and, therefore, it should work.

Custom Gradle Plugin ID not found

I'm writing a Gradle plugin and I'm failing to get the apply plugin: command to work in the Gradle script that uses the plugin. I'm using Gradle 1.1.
I've build the plugin with clean build and I'm attempting to add it to the Gradle build via a flat repo for now. That seems to be working but Gradle isn't picking up that there is a plugin with the ID test-plugin. The project name in the plugin's settings.gradle is test-plugin and the properties file in META-INF/gradle-plugins is also test-plugin.properties. I'm not sure where else I can specify the plugin ID.
The build.gradle file in the project that is using the test-plugin:
repositories {
flatDir name: 'libs', dirs: "../build/libs"
}
dependencies {
compile 'test:test-plugin:0.1'
}
apply plugin: 'test-plugin'
Error from Gradle:
What went wrong:
A problem occurred evaluating root project 'tmp'.
Plugin with id 'test-plugin' not found.
The plugin Jar has to be added as a build script dependency:
buildscript {
repositories { flatDir name: 'libs', dirs: "../build/libs" }
dependencies { classpath 'test:test-plugin:0.1' }
}
apply plugin: "test-plugin"
If you want to implement a plugin into your buildscript, then you have two options.
Option 1
apply plugin: YourCustomPluginClassName
Option 2
plugins {
id 'your.custom.plugin.id'
}
apply plugin: is used when specifying your plugin by its class name (ex. apply plugin: JavaPlugin)
plugins { } is used when specifying your plugin by its id (ex. plugins { id 'java' })
See Gradle Plugins by tutorialspoint for reference
If you choose Option 1, the your custom plugin will need to be brought into your build script by 1 of 3 ways.
You can code it directly within your Gradle build script.
You can put it under buildSrc (ex. buildSrc/src/main/groovy/MyCustomPlugin).
You can import your custom plugin as a jar in your buildscript method.
See Gradle Goodness by Mr. Haki for information about the buildscript method.
If you choose Option 2, then you need to create a plugin id. Create the following file buildSrc/src/main/resources/META-INF/gradle-plugins/[desired.plugin.id].properties.
Copy and paste implementation-class=package.namespace.YourCustomPluginClassName into your newly created .properties file. Replace package.namespace.YourCustomPluginClassName with the fully-qualified class name of your desired plugin class.
See Custom Plugins by Gradle for more info.
I also had the same problem with a custom plugin id not being found. In my case, I simply forgot to add the 'src/main/resources/META-INF/gradle-plugins' properties file. The name of the properties file must match the name of the plugin id with a '.properties' extension.
The file must contain a the line:
implementation-class=(your fully qualified plugin classpath)
That's the complete mechanism on how plugin id's get resolved to class names.
In addition the plugin needs to be added as a dependency as pointed out in the previous answer. The android documentation states that you should use a name associated with your unique domain name. I.e.: the name 'test-plugin' is not really in good form, but an id like 'com.foo.gradle.test-plugin' would be better.
Ensure that your top-level build.gradle uses the correct classpath to refer to the path to the built *.jar file.
Some plugins, like maven-publish, will build and save the jar to a specific location in mavenLocal, but the path may not be clear to see.
You should look at the file path of the jar file, and ensure it matches your classpath, but the mapping is not immediately obvious:
buildscript {
dependencies {
// This *MUST* match the local file path of the jar file in mavenLocal, which is:
// ~/.m2/repository/com/company/product/plugin/product-gradle-plugin/1.0/product-gradle-plugin-1.0.jar
classpath 'com.company.product.plugin:product-gradle-plugin:1.0'
}
}
Be careful not to use the wrong classpath, which can refer to a directory instead of the actual jar file; like this:
buildscript {
dependencies {
// This is wrong, because it refers to the mavenLocal FOLDER "product-gradle-plugin",
// instead of the jar FILE "product-gradle-plugin-1.0.jar"
// However, a gradle sync will still resolve it as a valid classpath!!
classpath 'com.company.product:product-gradle-plugin:1.0'
}
}
More info:
https://discuss.gradle.org/t/what-is-the-preferred-gradle-approach-to-locally-install-an-artifact-equivalent-to-mavens-install/5592
https://docs.gradle.org/current/userguide/publishing_maven.html
https://blog.codefx.org/tools/snapshots-gradle-maven-publish-plugin/
https://docs.gradle.org/current/userguide/custom_plugins.html#sec:custom_plugins_standalone_project
Adding to what #Bonifacio2 wrote this is a path META-INF/gradle-plugins and shows in IntelliJ as META-INF.gradle-plugins. At all costs don't make the stupid mistake I did creating this directly as a directory META-INF.gradle-plugins because you are based on another sample, and never works. Another tip is copying also from another intelliJ project as this is what is added: gradle-plugins.
hmm perhaps try;
configure <org.jsonschema2pojo.gradle.JsonSchemaExtension> {
this.sourceFiles = files("${project.rootDir}/schemas")
}

How to include predefined set of netbeans platform modules in maven project?

I am working on maven netbeans platform project consisting of several modules. I need to depend on some modules (say java.source module), but when I try to run the application, it reports, that required modules are not installed. And event despite I have dependency on java.source declared in my pom.xml
I think, that I have to tell maven somehow, to install (and turn on) these modules in the final assembled application before my module is loaded.
How could I do something like this?
UPDATE:
When I try to create complete netbeans application project from maven artifact and add Java Source API as a dependency into pom.xml... when I run the application, window with following message appears:
Warning - could not install some modules: Editor Library 2 - None of the modules providing the capability org.netbeans.modules.editor.actions could be installed. Editor Indentation for Projects - The module named org.netbeans.modules.editor.settings.storage/1 was needed and not found. Editor Indentation for Projects - The module named org.netbeans.modules.options.editor/1 was needed and not found. Project UI API - No module providing the capability org.netbeans.modules.project.uiapi.ActionsFactory could be found. Project UI API - No module providing the capability org.netbeans.modules.project.uiapi.OpenProjectsTrampoline could be found. Project UI API - No module providing the capability org.netbeans.modules.project.uiapi.ProjectChooserFactory could be found. Editor Error Stripe Impl - The module named org.netbeans.modules.editor.errorstripe.api/1 was needed and not found. Java Source - The module named org.netbeans.libs.javacimpl/1 was needed and not found. Java Source - The module named org.netbeans.modules.editor.indent.project/0-1 was needed and not found. Java Source - The module named org.netbeans.modules.java.preprocessorbridge was needed and not found. Java Source - The module named org.netbeans.modules.options.editor/1 was needed and not found. Java Source - The module named org.netbeans.modules.parsing.api/1 was needed and not found. Editor Settings - No module providing the capability org.netbeans.api.editor.settings.implementation could be found. Diff - The module named org.netbeans.modules.options.editor/1 was needed and not found. 11 further modules could not be installed due to the above problems.
The error-message "Module dependency has friend dependency [...] but is not listed as friend" means that you need to specify an implementation version of org.netbeans.modules.options.editor.
You can achieve this by editing src/main/nbm/module.xml to contain the following entry (I didn't use the actually needed values here. Make sure to find out which values to enter for id and explicitValue to satisfy the dependencies (You can find explanations / instructions in the article linked below):
<dependencies>
<dependency>
<id>org.netbeans.modules:org-netbeans-modules-editor</id>
<type>impl</type>
<explicitValue>org.netbeans.modules.editor/1 = 201107282000</explicitValue>
</dependency>
</dependencies>
I'm pretty sure that the following article will explain some issues and help you find out the needed values for id and explicitValue (language is english, author is me):
http://blog.macrominds.de/2011/08/open-favorites-per-default-in-netbeans-rich-client-platform-maven-standalone-application/
I'm currently having related problems with my application, so I might come back with a more concrete solution in a while.
the easiest way is to grab a class that its complaining about, say "org.netbeans.modules.editor.actions" and go to the Add Dependencies and plug it into the Query field.
From there you should be able to tell which module you will need to include

GWT Failure to load module '<mymodule>'

When configuring a second Entrypoint and second module in my gwt application I receive the following warning:
[WARN] Unknown module requested 'iovadmin'; all active GWT modules must be specified in the command line arguments
and the following error:
[ERROR] Unable to find 'iovadmin.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
Can someone explain me the necessary steps to correctly configure a second entrypoint in my application?
Thanks in advance,
Tom
If you want to have a second EntryPoint, make sure that you have all the needed files. That is:
- In your project src/com/.../ root folder you must have your SecondEntry.gwt.xml file, with the proper tag
- In your war/ folder you need to have the proper SecondEntry.html file
- In your war/WEB-INF/web.xml you need to have the proper servlet-mapping pointing to your second servlet.
If you have all these files, you'll need to post them to see where's the problem.