Hybris how to prevent generation of addonsrc and commonwebsrc during compilation? - sap-commerce-cloud

We have a structure where we have 2 modulegen extensions testfacades and teststorefront. We have also generated testwebservices extension from ycommercewebservices. We have installed orderselfserviceaddon to teststorefront.
Now when we are adding testfacades dependency to testwebservices, we are getting compile error below:
[echo] Compile addonsrc testwebservices - orderselfserviceaddon
[yjavac] Compiling 7 source files to C:\carrefour\HybrisFood\hybris\bin\custom\carrefour\testwebservices\web\webroot\WEB-INF\classes
[yjavac] ----------
[yjavac] 1. ERROR in C:\carrefour\HybrisFood\hybris\bin\custom\carrefour\testwebservices\web\addonsrc\orderselfserviceaddon\de\hybris\platform\orderselfserviceaddon\controllers\pages\AccountReturnsPageController.java (at line 16)
[yjavac] import de.hybris.platform.acceleratorstorefrontcommons.annotations.RequireHardLogIn;
[yjavac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[yjavac] The import de.hybris.platform.acceleratorstorefrontcommons.annotations cannot be resolved
Why its happening? How can I prevent this folders to generate during build?

Because you installed orderselfserviceaddon onto your testwebservices project, it copies over all source code (inside of the web folder) of that addon into the addonsrc folder. This is how the addon install process of hybris works. With every ant clean all this folder will be overwritten.
It appears that the addon you installed (orderselfserviceaddon) had a dependency on an annotation in another addon.
If you don't need this addon in the test project, remove the <requires-extension="orderselfserviceaddon"/> from the extensioninfo.xml of the testwebservices addon.
If you need this code here, you can simply add the required extensions tag in your extensionsinfo.xml (of testwebservices) to also include the acceleratorstorefrontcommons code in this addon.
<requires-extension name="acceleratorstorefrontcommons"/>

Related

Android Studio fails to resolve / index imported modules correctly

My project setup:
app -- (android project) -- requires both module A and module B
moduleA( java library gradle project) --
moduleB ( java library gradle proejct) -- depends on module A
If I import module A, either through the IDE(import gradle project),
or by editing the build.gradle / settings files of my
android project, no issue, it will import correctly, compile/index
just fine. I am able to navigate to the contained classes..etc
When I import module B through the IDE, I get an jetbrains.android
plugin error that it could not save the settings.
Upon reboot, many other plugin errors occur .
IF I import module B by manually editing the apps build file, and
settings file, The system will compile just fine. However,
it will not index/resolve properly, making editing a pain...
The only difference between module A and B. is that B has
a gradle settings file within it, which contains its dependency
on A.
I have tested this out on other module which contain dependencies, and
the exact same issue occurs.
Any suggestions would be greatly appreciated.

Using an Android Studio project as a library

I have created a project in Android Studio (1.3.0) that will contain several modules and will serve as a library for other projects.
Library Project:
Inside my library, some modules have some dependencies on other modules (intraproject dependency). Let say libmod1 has dependencies on libmod2. In build.gradle of libmod1, I have compile project(':libmod2').
Application Project:
From an application project, I would like to import libmod1 (interproject dependency). In build.gradle, I add compile project(':..:LibProject:libmod1').
Problem:
When I build the application project, I get an error message from gradle:
Error:(24, 0) Project with path ':libmod2' could not be found in
project ':..:LibProject:libmod1'.
Gradle failed to resolve the intraproject dependency.
I have to change the build.gradle of libmod1 to compile project(':..:LibProject:libmod2') to get rid of this error. Meaning the intraproject dependencies must be changed when I reference them from another project.
Question:
Is there a way to tell Gradle that the intraproject dependencies are relative to the library project and not relative to the application project ? Such that when I have interproject dependencies on the library modules, the intraproject dependencies can be resolved ?
Of course, I could also remove the intraproject dependencies between the modules. But is there a different way to solve this problem ?
You have to add the dependencies in your settings.gradle. If the modules are in the same folder its easy just connect them by
include ':libmod1',':libmod2'
If your libraries are located in other folders (not in any subfolder) you have to connect them in your settings.gradle:
project(':libmod1').projectDir = new File(settingsDir, '../path/to/libmod1')
See also https://docs.gradle.org/current/userguide/multi_project_builds.html

Error while adding mp4parser library to a project in android studio

I'm trying to use mp4parser library in my project. My android studio version is 1.0.2. Here's what I've done so far:
I've downloaded mp4parser zipfile from the link: https://github.com/sannies/mp4parser
I've extracted the zip file to MyProjectName/app/libraries
Renamed the folder to mp4parser
Add this line of code to settings.gradle file:
include ':app:libraries:mp4parser'
Add this line of code to build.gradle (in dependencies block):
compile project('libraries:mp4parser')
Now I want to sync the project with gradle files. This error pops up:
Error:Configuration with name 'default' not found.
I don't have this problem with other libraries. Seems that its only mp4parser that I have problem with. How can I fix this?
If you're including the library as source, the best thing to do is to unpack it somewhere and import it as a module.
The error you're getting is cryptic but it means that the build system is looking for a build.gradle file at that location and not finding it (or it doesn't see an apply plugin statement in the file telling it what to do). I'm assuming that the library you're trying to use doesn't have a Gradle build script.
If you import the library using the Android Studio UI, a build script will be generated for the module and you should be good to go.

Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr;

i use ActionBarLibrary in a library, that I use in a my app
i got this message when i try to compil
[2013-01-28 16:09:46 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr;
[2013-01-28 16:09:46 - comfree] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr;
As asked here, I was facing the exact same error yesterday. I pinpointed the cause of the error to /bin/classes. If I deleted the /classes dir before running the app, the app would compile and run. Of course, when I tried to actually export the app, the /classes dir would come back and along with it the error.
The solution to my problem was to install the latest version of Eclipse. You will then need to install the latest version of the ADT but all the Android versions you have downloaded earlier for the other Eclipse installation will be detected and used for this one as well. When I export or run the app through Eclipse, the /classes folder does not appear now.
right click on project to go project property>>java Build path>>choose Order and Export and then Unselect all except android4.0 or what every you have then clean and build your project ,now error not come again..
The solution to my problem was that I deleted the jar files which I copy pasted in project's lib folder. I explicitly imported external jars in build path

Visual C++ - cant see which external missing

I try to build my multiproject application in Visuas C++ 10 in release mode.
I get the next link error:
2> All outputs are up-to-date.
2>PidAppLib.lib(ThreadWin32.obj) : error LNK2011: precompiled object not linked in; image may not run
2>C:\infinite_memories_svn\projects\sw\NewPidTools\PidWriter\Release\PidLabler.exe : fatal error LNK1120: 1 unresolved externals
2>
2>Build FAILED.
How can I know which object unresolved?
ThreadWin32.obj is external lib which was downloaded from internet.
Ok.
I've solved the problem.
I have 2 libraries, let say a.lib and b.lib, and project, c.
a.lib uses b.lib so in librarian dependencies of a.lib I added b.lib, c uses a.lib so I added
it to dependencies.
It works in debug but in release I should also add b.lib to dependencies of c.
Strange but it solved the problem
I had this error in a large project I was refactoring. During the refactoring process I would occasionally compile individual source files to check changes I'd made without having to build the entire project. Depending on your project configuration this can result in .obj files being output in a different directory to where they would normally be output when you build the project. In my case the .obj files for source files compiled manually were output in the source code directory instead of the intermediate build directory.
A side-effect of this appeared to be that when building the whole project, source files that had been manually compiled might not be recompiled even if other changes elsewhere meant they should be (like a change that required recompiling the precompiled header file).
The solution for me was to manually delete all .obj files generated by manually compiling individual source files. Depending on project configuration executing Clean on the project might also work.

Resources