{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/1254","repository_url":"https://api.github.com/repos/GoogleContainerTools/jib","labels_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/1254/labels{/name}","comments_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/1254/comments","events_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/1254/events","html_url":"https://github.com/GoogleContainerTools/jib/issues/1254","id":381642107,"node_id":"MDU6SXNzdWUzODE2NDIxMDc=","number":1254,"title":"Do no include runtime/provided/optional maven dependencies in image","user":{"login":"paskos","id":2422690,"node_id":"MDQ6VXNlcjI0MjI2OTA=","avatar_url":"https://avatars1.githubusercontent.com/u/2422690?v=4","gravatar_id":"","url":"https://api.github.com/users/paskos","html_url":"https://github.com/paskos","followers_url":"https://api.github.com/users/paskos/followers","following_url":"https://api.github.com/users/paskos/following{/other_user}","gists_url":"https://api.github.com/users/paskos/gists{/gist_id}","starred_url":"https://api.github.com/users/paskos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paskos/subscriptions","organizations_url":"https://api.github.com/users/paskos/orgs","repos_url":"https://api.github.com/users/paskos/repos","events_url":"https://api.github.com/users/paskos/events{/privacy}","received_events_url":"https://api.github.com/users/paskos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-16T15:19:28Z","updated_at":"2018-11-16T18:08:11Z","closed_at":null,"author_association":"NONE","body":"**Description**: \r\nI am working on a spring-boot project and I have a runtime dependency on `spring-boot-devtools` that is used during development.\r\nWhen I build the image using `jib-maven-plugin` `spring-boot-devtools` is copied in `/libs` directory even if the scope is runtime.\r\n\r\n**Expected**: \r\nI expected the jar to be ignored the same way spring-boot maven plugin does not include it in the fat jar.\r\n\r\n**Step to reproduce**: \r\nCreate a maven project\r\nadd a dependency with <scope>runtime</scope>\r\nconfigure  jib-maven-plugin plugin\r\nbuild and run docker image\r\ndocker exec -it <container> /bin/bash\r\nlist the content of the libs/ directory\r\nthe runtime dependency will be in the directory \r\n\r\n**Environment**:\r\njib-maven-plugin: version 0.10.0\r\nOS: Mac OS X\r\nMaven: version 3.5.4\r\njava: version 1.8.0_181\r\n\r\n**`jib-maven-plugin` Configuration**: \r\n```xml\r\n[...]\r\n<dependencies>\r\n    <dependency>\r\n\t<groupId>org.springframework.boot</groupId>\r\n\t<artifactId>spring-boot-devtools</artifactId>\r\n\t<optional>true</optional>\r\n\t<scope>runtime</scope>\r\n    </dependency>\r\n</dependencies>\r\n<build>\r\n<plugins>\r\n<plugin>\r\n   <groupId>com.google.cloud.tools</groupId>\r\n   <artifactId>jib-maven-plugin</artifactId>\r\n   <version>${jib-maven-plugin.version}</version>\r\n     <configuration>\r\n       <from>\r\n          <image>${docker.registry.host}/${docker.from.image}</image>\r\n          <credHelper>ecr-login</credHelper>\r\n       </from>\r\n       <to>\r\n          <image>${docker.registry.host}/${project.artifactId}:${build.number}</image>\r\n          <credHelper>ecr-login</credHelper>\r\n          <tags>\r\n             <tag>${build.number}</tag>\r\n             <tag>latest</tag>\r\n           </tags>\r\n         </to>\r\n         <container>\r\n            <appRoot>${docker.root.dir}</appRoot>\r\n            <mainClass>${main.class}</mainClass>\r\n             <useCurrentTimestamp>${docker.use-current-timestamp}</useCurrentTimestamp>\r\n           </container>\r\n        </configuration>\r\n   </plugin>\r\n</plugins>\r\n</build>\r\n[...]\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/comments/439478139","html_url":"https://github.com/GoogleContainerTools/jib/issues/1254#issuecomment-439478139","issue_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/1254","id":439478139,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTQ3ODEzOQ==","user":{"login":"briandealwis","id":202851,"node_id":"MDQ6VXNlcjIwMjg1MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/202851?v=4","gravatar_id":"","url":"https://api.github.com/users/briandealwis","html_url":"https://github.com/briandealwis","followers_url":"https://api.github.com/users/briandealwis/followers","following_url":"https://api.github.com/users/briandealwis/following{/other_user}","gists_url":"https://api.github.com/users/briandealwis/gists{/gist_id}","starred_url":"https://api.github.com/users/briandealwis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briandealwis/subscriptions","organizations_url":"https://api.github.com/users/briandealwis/orgs","repos_url":"https://api.github.com/users/briandealwis/repos","events_url":"https://api.github.com/users/briandealwis/events{/privacy}","received_events_url":"https://api.github.com/users/briandealwis/received_events","type":"User","site_admin":false},"created_at":"2018-11-16T18:08:11Z","updated_at":"2018-11-16T18:08:11Z","author_association":"MEMBER","body":"The [Maven docs for `runtime`](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope) says:\r\n> This scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.\r\n\r\nAlthough you've marked `spring-boot-devtools` as optional, the docs say:\r\n> Optional dependencies - If project Y depends on project Z, the owner of project Y can mark project Z as an optional dependency, using the \"optional\" element. When project X depends on project Y, X will depend only on Y and not on Y's optional dependency Z. The owner of project X may then explicitly add a dependency on Z, at her option. (It may be helpful to think of optional dependencies as \"excluded by default.\")\r\n\r\nWhich I interpret to mean that any project that depends on *your* project won't pull in `spring-boot-devtools`.  But `spring-boot-devtools` is still a dependency for your project and will be pulled in.\r\n\r\nI think you'll need to use a Maven profile if you want to exclude `spring-boot-devtools`."}}
{"actor":{"display_login":"briandealwis"}}