google-code-export / wro4j

Automatically exported from code.google.com/p/wro4j
1 stars 1 forks source link

Add provision to take context path into account - Build Time Solution using MavenPlugin #878

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Images path in CSS are generated starting '/', but we want to deploy 
application on context path. These path does not work as application is not 
deployed on root.

What is the expected output? What do you see instead?
Ability to add context path in POM so that images paths are correct in output 
css.

What version of the product are you using? On what operating system?
1.7.5

Please provide any additional information below.
POM.XML

<plugin>
                <groupId>ro.isdc.wro4j</groupId>
                <artifactId>wro4j-maven-plugin</artifactId>
                <version>1.7.5</version>
                <executions>
                  <execution>
                    <phase>compile</phase>
                    <goals>
                      <goal>run</goal>
                    </goals>
                  </execution>
                </executions>
                <configuration>
                  <targetGroups>core</targetGroups>
                  <minimize>true</minimize>
                  <destinationFolder>${basedir}/src/main/webapp/wro/</destinationFolder>
                  <cssDestinationFolder>d:/static/css1/</cssDestinationFolder>
                  <jsDestinationFolder>d:/static/js/</jsDestinationFolder>
                  <contextFolder>${basedir}/src/main/webapp/</contextFolder>
                  <wroFile>${basedir}/src/main/webapp/WEB-INF/wro.xml</wroFile>
                  <ignoreMissingResources>false</ignoreMissingResources>
                </configuration>
              </plugin>

Original issue reported on code.google.com by Kartik...@gmail.com on 2 Jun 2014 at 12:35

GoogleCodeExporter commented 9 years ago
The contextPath is handled properly, but it is computed based on comparing the 
contextFolder with cssDestinationFolder. Since your destination folder is 
"d:/static/js/", wro4j cannot compute the context relative folder. 

Using something like: "${basedir}/src/main/webapp/wro/" should make it work.

Original comment by alex.obj...@gmail.com on 2 Jun 2014 at 12:42

GoogleCodeExporter commented 9 years ago
Hi

Thanks for quick reply. I have also tried set it as: 
${basedir}/src/main/webapp/static/wro/css/

Path of images in csss always starts like this:
/static/img/a.png

I have deployed application on context path, then "/static/img/a.png" path is 
not valid. It should be "/context_path/static/img/a.png"

Thanks & Regards,
Kartik

Original comment by Kartik...@gmail.com on 2 Jun 2014 at 5:07

GoogleCodeExporter commented 9 years ago
I understand now... the plugin assumes the built war will be deployed as ROOT, 
but it isn't. Probably will add additional configuration property used to 
specify the context path.

Original comment by alex.obj...@gmail.com on 3 Jun 2014 at 8:19

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi

Thank you for looking into this. Any idea of timeline, by when we can have this 
setting?

Thanks,
Kartik

Original comment by Kartik...@gmail.com on 3 Jun 2014 at 8:52

GoogleCodeExporter commented 9 years ago
I don't like to make any promises, since it depends on my free time. But I 
could try start working on it this week... and if everything is completed, 
would be able to release by the end of the week or beginning of the next week.

Original comment by alex.obj...@gmail.com on 3 Jun 2014 at 8:58

GoogleCodeExporter commented 9 years ago
I appreciate your support on this.

Regards,
Kartik

Original comment by Kartik...@gmail.com on 3 Jun 2014 at 9:05

GoogleCodeExporter commented 9 years ago
Fixed in master branch.
The latest snapshot containing this fix was deployed on nexus snapshot 
repository (@see https://code.google.com/p/wro4j/wiki/FAQ about this). 

Could you try the latest snapshot? Let me know if everything looks good and I'm 
ready to release new version.

Original comment by alex.obj...@gmail.com on 13 Jun 2014 at 2:39

GoogleCodeExporter commented 9 years ago
Hi, Thanks you for this.

I need information to test this update:
How to set context path in wro4j maven plugin? I guess there should be a new 
property for this? Please provide some sample / more info on this.

Regards,
Kartik

Original comment by Kartik...@gmail.com on 15 Jun 2014 at 11:30

GoogleCodeExporter commented 9 years ago
Yes, add the following config option in plugin configuration:

<contextPath>myapp</contextPath>

Original comment by alex.obj...@gmail.com on 15 Jun 2014 at 12:35

GoogleCodeExporter commented 9 years ago
@Kartik626 any feedback? I'm ready to release new version.

Original comment by alex.obj...@gmail.com on 17 Jun 2014 at 3:22

GoogleCodeExporter commented 9 years ago
Hi, I tried reviewing this. However I was not able to get snapshot version. 
Maven build is giving error that this version is not available.

Original comment by Kartik...@gmail.com on 17 Jun 2014 at 3:27

GoogleCodeExporter commented 9 years ago
As mentioned earlier (@see FAQ link), the snapshots are available here: 
https://oss.sonatype.org/content/repositories/snapshots/

Just add this repository in your pom.xml configuration or download the jar 
manually.

Original comment by alex.obj...@gmail.com on 17 Jun 2014 at 3:29

GoogleCodeExporter commented 9 years ago
I have added this repository in pom, its its going to maven central for 
download. I tried by adding manually jars, then this error shows up:

Failed to read artifact descriptor for 
ro.isdc.wro4j:wro4j-maven-plugin:jar:1.7.6-SNAPSHOT

IS there any other way i can test this update?

Original comment by Kartik...@gmail.com on 17 Jun 2014 at 4:02

GoogleCodeExporter commented 9 years ago
Checkout the project from github, use branch 1.7.x. Install it it locally
and try again.

into account - Build Time Solution using MavenPlugin

download. I tried by adding manually jars, then this error shows up:

ro.isdc.wro4j:wro4j-maven-plugin:jar:1.7.6-SNAPSHOT

Original comment by alex.obj...@gmail.com on 17 Jun 2014 at 4:15

GoogleCodeExporter commented 9 years ago
Sorry, i could not solve issue in my maven configuration. May be i will be able 
to check with 1.7.6 released version only.

Original comment by Kartik...@gmail.com on 17 Jun 2014 at 4:15

GoogleCodeExporter commented 9 years ago
Ok, I'll release later taday.

Original comment by alex.obj...@gmail.com on 17 Jun 2014 at 4:18

GoogleCodeExporter commented 9 years ago
@Kartik626 the 1.7.6 version was released and is already available on maven 
central repo. Let me know if you find any issues with it.

Original comment by alex.obj...@gmail.com on 18 Jun 2014 at 9:00

GoogleCodeExporter commented 9 years ago
I am able to test this now. Its working perfectly fine.

Thank you for looking into this.

Original comment by Kartik...@gmail.com on 19 Jun 2014 at 5:18