Spring Roo , Custom Dojo Build - dojo

I have been attempting to implement a custom dojo build to replace the dojo version that comes with spring roo 1.1.5.
I followed the instructions at
http://sagittech.blogspot.com/2011/08/asdadsad-qwasdace-aavvrv-place-holder.html
as well as
http://www.qc4blog.com/?p=1001
I have been able to create the builds.
My problem is that when I place the new build into the project like
WEB-INF\classes\META-INF\web-resources\dojo-1.6.2\
(FYI: I renamed the version from 1.6.1 to 1.6.2 to avoid conflict with same version as in
Roo.)
When I load my web page I get
syntax error
http://localhost:8080/app-1.0.0/resources/dojo-1.6.2/dojo/dojo.js
Line 14
also
missing ) after argument list
http://localhost:8080/app-1.0.0/
Line 3
dojo is not defined
http://localhost:8080/app-1.0.0/resources/spring/Spring-Dojo.js
Line 16
So, the question is:
What is the proper way to integrate a new custom dojo build with Spring Roo?
Is there a special way to build dojo to make this happen?
Are there additional steps required to make a custom build work with Roo?
Update:
Below is my profile file to create the new dojo.js
dependencies = {
optimize:"shrinksafe",
stripConsole: "normal",
cssOptimize: "comments",
layers:
[
{
name: "dojo.js",
layerDependencies:
[
"dojo.js",
],
dependencies:
[
"dijit.Dialog",
"dijit.Tooltip",
"dijit.form.DateTextBox",
"dijit.form.CheckBox",
"dijit.form.CurrencyTextBox",
"dojox.widget.Standby",
"dijit.form.ComboBox",
"dijit.form.FilteringSelect",
"dojox.form.PasswordValidator",
"dojo.parser",
"dijit.form.Form",
"dojox.grid.EnhancedGrid",
"dojo.data.ItemFileWriteStore",
"dijit.TitlePane",
"dijit.layout.LayoutContainer",
"dijit.layout.BorderContainer",
"dijit.form.SimpleTextarea",
"dijit.form.Textarea",
"dojo.date.locale",
"dojo.data.ItemFileReadStore",
"dojox.grid.cells.dijit",
"dojox.grid.DataGrid",
"dijit.form.Button",
"dijit.form.ValidationTextBox",
"dijit.Dialog",
"dijit.form.NumberSpinner",
"dojox.grid.enhanced.plugins.Menu",
"dojox.grid.enhanced.plugins.NestedSorting",
"dojox.grid.enhanced.plugins.IndirectSelection",
"dijit.MenuItem",
"dijit.MenuSeparator",
"dijit.PopupMenuItem",
"dijit.Menu",
"dojox.form.Uploader",
"dojox.form.uploader.FileList",
"dojox.form.uploader.plugins.Flash",
"dijit.form.Select"
]
}
],
prefixes: [
["dijit", "../dijit"],
["dojox", "../dojox"]
]
}
After making sure that I made the new optimized file the same as dojo.js to insure that dojo was found I now get the following error:
failed loading /app-1.0.0/resources/dojo-1.6.2/dojo/./parser.js with error: SyntaxError: syntax error
http://localhost:8080/app-1.0.0/resources/dojo-1.6.2/dojo/dojo.js
Line 14

I solved this in part by an answer given at
http://forum.springsource.org/showthread.php?118073-javascript-files-not-loading
I made sure that I had
<script type="text/javascript">dojo.require("dojo.parser");<!-- required for FF3 and Opera --></script>
Also, I had to verify that
<c:set var="dojo_baseline">/resources/dojo-1.6.2/</c:set>
pointed to the correct folder. Previously I had it at 1.6.1
also, that
webmvc-config.xml
looked like
<mvc:resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>

Related

adding css causes failed build with Vue and Filepond

So, I am trying to follow a number of the file pond example and each of them include some form of CSS import (I get it, there is a lot that comes with beauty). However, no matter what I try, Filepond or Pintura (formerly Doka), I get this error in some form:
Compiled with problems:
ERROR in ./node_modules/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css
Module build failed (from ./node_modules/style-loader/dist/cjs.js):
ValidationError: Invalid options object. Style Loader has been initialized using an options object that does not match the API schema.
- options should be an object:
object { injectType?, attributes?, insert?, base?, esModule?, modules? }
at validate (/Users/ryanolson/github/realkinkmen/node_modules/style-loader/node_modules/schema-utils/dist/validate.js:105:11)
at Object.loader (/Users/ryanolson/github/realkinkmen/node_modules/style-loader/dist/index.js:25:29)
ERROR in ./node_modules/filepond/dist/filepond.min.css
Module build failed (from ./node_modules/style-loader/dist/cjs.js):
ValidationError: Invalid options object. Style Loader has been initialized using an options object that does not match the API schema.
- options should be an object:
object { injectType?, attributes?, insert?, base?, esModule?, modules? }
at validate (/Users/ryanolson/github/realkinkmen/node_modules/style-loader/node_modules/schema-utils/dist/validate.js:105:11)
at Object.loader (/Users/ryanolson/github/realkinkmen/node_modules/style-loader/dist/index.js:25:29)
I have NO IDEA how to fix this as I am not experienced enough with what would be going on. I am guessing it has to do with Webpack and build but no idea what I need to do to fix it. Any help?
I also want to mention this is a Laravel/VueJS/Tailwind stack
The solution is to add the CSS files to the app.css file under /resources/css/app.css
#import 'filepond/dist/filepond.min.css';
#import "filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css";

Recommended dynamic runtime configuration technique on nuxtjs (other than dotenv)

I have been trying to use publicRuntimeConfig / privateRuntimeConfig
On nuxt 2.4.1, I have defined my runtime config as follows on nuxt.config.js
publicRuntimeConfig: {
DATA_API_HOST_URL: process.env.VUE_APP_DATA_API_HOST_URL,
},
privateRuntimeConfig: {
AUTH_APP_CLIENT_SECRET: process.env.VUE_APP_AUTH_APP_CLIENT_SECRET,
},
and calling it as follows on my login.vue
asyncData( ctx ) {
console.log(ctx.$config.DATA_API_HOST_URL)
//some activity
}
The keys are showing up on $config inside asyncData. I debugged on chrome dev tools. But value is not read from process.env.VUE_APP_DATA_API_HOST_URL. The value is showing up as undefined. However, process.env.VUE_APP_DATA_API_HOST_URL is showing the value OK. The whole point is to move away from process.env.
this.$config.DATA_API_HOST_URL also does not access the values.
'${DATA_API_HOST_URL}' is shown in examples but I believe it is only for explicit param declarations at asyncData like asyncData( { $config : {DATA_API_HOST_URL}).
When I pass values as it is using DATA_API_HOST_URL: process.env.VUE_APP_DATA_API_HOST_URL || 'https://test.api.com', it seems to copy the value fine using ctx.$config.DATA_API_HOST_URL!
Looking to me like copying process.env to *RuntimeConfig has a problem!
What is the recommended way of importing and using runtime configurations?
As per documentation in the Nuxt blog post you marked, the feature your are trying to use is released in 2.13 (you´re using 2.4 if i not misunderstood). That could be the reason behind the behaviour you're seeing.
I'd recommend update your project dependencies or trying another approach.
I think you should use Docker to set dynamic runtime config like link below:
https://dev.to/frontendfoxes/dockerise-your-nuxt-ssr-app-like-a-boss-a-true-vue-vixens-story-4mm6

rollup , how to bundle .css and min.css at the same time

I use rollup with rollup-plugin-scss plugin in the project to bundle css. Is it possible to generate both .css and .min.css using this plugin or some other plugins?
plugins: [
scss({
output: path.resolve(__dirname, 'projects/project_name/main.css'),
})
]
I tried to add outputStyle: "compressed" but this make only compressed version, not both.
It is not possible out of the box but you hook into the output option that also take a function as option and write both files manually (including a compression step). In the sample code below I used clean-css but there are plenty of other packages available.
scss({
output: function (styles, styleNodes) {
fs.writeFileSync('bundle.css', styles)
const compressed = new CleanCss().minify(styles).styles;
fs.writeFileSync('bundle.min.css', compressed)
}
})
Note that this setup does not have any logging or filesizes or anything as you get it from the regular plugin, but this is something that can be added fairly easily into the function.

How to grab a dependency and make it work with IntelliJ project?

I am trying to start a GroovyFX project within IntelliJ 12.
However, I have not been able to get IntelliJ to compile and run the following simple script (for reproducing the problem in the simplest manner possible):
#Grab(group='org.codehaus.groovyfx', module='groovyfx', version='0.3.1')
import groovyx.javafx.GroovyFX
println GroovyFX.class.name
I used IntelliJ's support for Grape's Grab to add groovyfx as a dependency of my module (the jar is shown under "External Libraries" and the editor does not complain that the class is missing after that!) but still, when I run the script, it throws an error:
Groovyc: unable to resolve class groovyx.javafx.GroovyFX
I was able to get this script working in the GroovyConsole without much problem and as expected....
I tried grabbing another randomly chosen dependency (turned out to be a Spring library) and it worked straight out:
#Grab(group='org.springframework', module='spring', version='2.5.6')
import org.springframework.jdbc.core.JdbcTemplate
println JdbcTemplate.class.name
I can see no good reason why the Spring library should work, but not the GroovyFX library!!!!
I even double checked that the GroovyFx library had been actually downloaded, and it is there where it should be (under {user.home}/.groovy/grapes/{group}/{module}/jars/)
What can cause this weird and extremely frustrating problem??
I tested your problem both with groovyConsole (from groovy-sdk-2.1.0) and with IntelliJ IDEA 12.0.3. The only exception I got was:
Caught: java.lang.NoClassDefFoundError: javafx/application/Application
java.lang.NoClassDefFoundError: javafx/application/Application
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
... 1 more
This was because the JavaFX runtime (jfxrt.jar) was not in the classpath. This can be fixed with
mvn com.zenjava:javafx-maven-plugin:1.3:fix-classpath
The command above is taken from the JavaFX Maven Plugin Wiki. You have to execute it only once. After that change both groovyConsole and IntelliJ are working. I had to restart the groovyConsole, this was not necessary for IntelliJ.
What is interesting is that I don't see the GroovyFx-jar under "External Libraries". I am using plain IDEA community edition without any plugins.
The Hello World from the GroovyFX homepage works out of the box in IDEA but not in the groovyConsole - I also get the "java.lang.ClassNotFoundException: groovyx.javafx.GroovyFX". I managed to let it run with the following code, but it is not a good solution, since it works only on the first run, then you have to restart the groovyConsole:
#GrabConfig(systemClassLoader=true, initContextClassLoader=true)
#Grab(group='org.codehaus.groovyfx', module='groovyfx', version='0.3.1')
import static groovyx.javafx.GroovyFX.start
start {
stage(title: 'GroovyFX Hello World', visible: true) {
scene(fill: BLACK, width: 500, height: 250) {
hbox(padding: 60) {
text(text: 'Groovy', font: '80pt sanserif') {
fill linearGradient(endX: 0, stops: [PALEGREEN, SEAGREEN])
}
text(text: 'FX', font: '80pt sanserif') {
fill linearGradient(endX: 0, stops: [CYAN, DODGERBLUE])
effect dropShadow(color: DODGERBLUE, radius: 25, spread: 0.25)
}
}
}
}
}
I am not sure but I think the reason is this bug here. Should be fixed in Groovy 2.2, we will see.

How to use a dependency of a module within a Play app

I am writing a Play Framework module in order to share some common logic among multiple Play apps. One of the things I would like my module to do is provide some frequently-used functionality by way of 3rd-party modules, for example the excellent Markdown module.
First of all, is it possible to do this? I want all the apps that include my module to be able to use the .markdown().raw() String extension without needing to explicitly declare the Markdown module as a dependency. The Play Framework Cookbook chapter 5 seems to imply that it is possible, unless I am reading it wrong.
Secondly, if it is possible, how does it work? I have created the following vanilla example case, but I'm still getting errors.
I created a new, empty application "myapp", and a new, empty module "mymod", both in the same parent directory. I then modified mymod/conf/dependencies.yml to:
self: mymod -> mymod 0.1
require:
- play
- play -> markdown [1.5,)
I ran play deps on mymod and it successfully downloaded and installed the Markdown module. Running play build-module also worked fine with no errors.
Then, I modified myapp/conf/dependencies.yml to:
# Application dependencies
require:
- play
- mymod -> mymod 0.1
repositories:
- Local Modules:
type: local
artifact: ${application.path}/../[module]
contains:
- mymod
I ran play deps on myapp and it successfully found mymod, and generated the myapp/modules/mymod file, containing the absolute path to mymod.
I ran myapp using play run and was able to see the welcome page on http://localhost:9000/. So far so good.
Next, I modified myapp/app/views/Application/index.html to:
#{extends 'main.html' /}
#{set title:'Home' /}
${"This is _MarkDown_, by [John Gruber](http://daringfireball.net/projects/markdown/).".markdown().raw()}
I restarted myapp, and now I get the following error.
09:03:23,425 ERROR ~
#6a6eppo46
Internal Server Error (500) for request GET /
Template execution error (In /app/views/Application/index.html around line 4)
Execution error occured in template /app/views/Application/index.html. Exception raised was MissingMethodException : No signature of method: java.lang.String.markdown() is applicable for argument types: () values: [].
play.exceptions.TemplateExecutionException: No signature of method: java.lang.String.markdown() is applicable for argument types: () values: []
at play.templates.BaseTemplate.throwException(BaseTemplate.java:86)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:257)
at play.templates.Template.render(Template.java:26)
at play.templates.GroovyTemplate.render(GroovyTemplate.java:187)
at play.mvc.results.RenderTemplate.<init>(RenderTemplate.java:24)
at play.mvc.Controller.renderTemplate(Controller.java:660)
at play.mvc.Controller.renderTemplate(Controller.java:640)
at play.mvc.Controller.render(Controller.java:695)
at controllers.Application.index(Application.java:13)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
at Invocation.HTTP Request(Play!)
Caused by: groovy.lang.MissingMethodException: No signature of method: java.lang.String.markdown() is applicable for argument types: () values: []
at /app/views/Application/index.html.(line:4)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:232)
... 13 more
And just to confirm I'm not crazy, I tried adding the play -> markdown [1.5,) line to myapp/conf/dependencies.yml and restarted the app, and confirmed that it works.
I feel like I'm missing something obvious. Many thanks in advance to anyone who can help! :)
Yes I had the same problem, it seems that transitive dependencies through custom home made modules does not work